예제 #1
0
LRESULT CNBBindListViewCtrl::OnGetDispInfo(LPNMHDR lParam)
{
	NMLVDISPINFO *pDispInfo = reinterpret_cast<NMLVDISPINFO*>(lParam);
	CNBUnitDevice *obj;

	obj = (CNBUnitDevice *)pDispInfo->item.lParam;
	ATLASSERT( obj );

	switch ( pDispInfo->item.iSubItem )
	{
	case 0: // Index
		::_stprintf(
			pDispInfo->item.pszText,
			_T("%d"), 
			pDispInfo->item.iItem
			);
		break;
	case 1:	// Name
		::_tcsncpy( 
			pDispInfo->item.pszText,  
			obj->GetName(),
			pDispInfo->item.cchTextMax-1
			);
		break;
	case 2:	// ID
/*
		::_tcsncpy(
			pDispInfo->item.pszText,  
			phandler->GetStringID( obj ),
			pDispInfo->item.cchTextMax-1
			);
		break;
	case 3: // Size
*/
		{
			::_tcsncpy(
				pDispInfo->item.pszText,  
				obj->GetCapacityString(),
				pDispInfo->item.cchTextMax-1
				);
		}		
	default:
		break;
	}
	pDispInfo->item.pszText[pDispInfo->item.cchTextMax-1] = '\0';
	return 0;
}
예제 #2
0
LPARAM CNBListViewCtrl::OnGetDispInfo(LPNMHDR lParam)
{
	NMLVDISPINFO *pDispInfo = reinterpret_cast<NMLVDISPINFO*>(lParam);
	CNBUnitDevice *obj;

	obj = (CNBUnitDevice *)pDispInfo->item.lParam;
	ATLASSERT(obj);

	pDispInfo->item.mask |= LVIF_DI_SETITEM;

	switch ( pDispInfo->item.iSubItem )
	{
	case 0:	// Name
		::_tcsncpy( 
			pDispInfo->item.pszText,  
			obj->GetName(),
			pDispInfo->item.cchTextMax-1
			);
		break;
	case 1:	// ID
/*
		::_tcsncpy(
			pDispInfo->item.pszText,  
			phandler->GetStringID( obj ),
			pDispInfo->item.cchTextMax-1
			);
		break;
	case 2: // Size
*/
		{
			::_tcsncpy(
				pDispInfo->item.pszText,  
				obj->GetCapacityString(),
				pDispInfo->item.cchTextMax-1
				);
		}
	default:
		break;
	}
	pDispInfo->item.pszText[pDispInfo->item.cchTextMax-1] = '\0';
	return 0;
}