当前位置: 首页>>代码示例>>C++>>正文


C++ CDiskObjectPtr::GetTitle方法代码示例

本文整理汇总了C++中CDiskObjectPtr::GetTitle方法的典型用法代码示例。如果您正苦于以下问题:C++ CDiskObjectPtr::GetTitle方法的具体用法?C++ CDiskObjectPtr::GetTitle怎么用?C++ CDiskObjectPtr::GetTitle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CDiskObjectPtr的用法示例。


在下文中一共展示了CDiskObjectPtr::GetTitle方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: CompareItems

int CNBListViewCtrl::CompareItems(CDiskObjectPtr obj1, CDiskObjectPtr obj2)
{
	int signAsc = m_abSortAsc[m_iColSort]? 1 : -1;

	switch(m_iColSort)
	{
	case 0:
		return signAsc * obj1->GetTitle().Compare( obj2->GetTitle() );
		break;
	case 1:
		return signAsc * obj1->GetStringDeviceID().Compare( obj2->GetStringDeviceID() );
		break;
	case 2:
		{
			_int64 size1, size2;
			size1 = obj1->GetUserSectorCount();
			size2 = obj2->GetUserSectorCount();
			if ( size1 > size2 )
				return signAsc;
			else if ( size1 == size2 )
				return 0;
			else
				return (-1) * signAsc;
		}
		break;
	default:
		break;
	}
	return 0;
}
开发者ID:,项目名称:,代码行数:30,代码来源:

示例2: OnGetDispInfo

LRESULT CNBBindListViewCtrl::OnGetDispInfo(LPNMHDR lParam)
{
	NMLVDISPINFO *pDispInfo = reinterpret_cast<NMLVDISPINFO*>(lParam);
	CDiskObjectPtr obj;
	const CObjectUIHandler *phandler;

	obj = m_mapObject[static_cast<UINT>(pDispInfo->item.lParam)];
	ATLASSERT( obj.get() != NULL );

	phandler = CObjectUIHandler::GetUIHandler( 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->GetTitle(),
			pDispInfo->item.cchTextMax-1
			);
		break;
	case 2:	// ID
/*
		::_tcsncpy(
			pDispInfo->item.pszText,  
			phandler->GetStringID( obj ),
			pDispInfo->item.cchTextMax-1
			);
		break;
	case 3: // Size
*/
		{
			WTL::CString strSize;
			strSize.FormatMessage(
				IDS_LISTVIEW_SIZE_IN_GB,
				phandler->GetSizeInMB( obj ) / 1024,
				(phandler->GetSizeInMB( obj ) % 1024) / 10
				);
			::_tcsncpy(
				pDispInfo->item.pszText,  
				strSize,
				pDispInfo->item.cchTextMax-1
				);
		}		
	default:
		break;
	}
	pDispInfo->item.pszText[pDispInfo->item.cchTextMax-1] = '\0';
	return 0;
}
开发者ID:,项目名称:,代码行数:56,代码来源:

示例3: OnClearDIB

BOOL CUnsupportedDiskUIHandler::OnClearDIB(CDiskObjectPtr obj) const
{
	ATLASSERT( dynamic_cast<CUnitDiskObject*>(obj.get()) != NULL);

	WTL::CString strWarning;
	strWarning.FormatMessage( 
			IDS_UIHANDLER_CLEARDIB_CONFIRM,
			obj->GetTitle()
			);
	WTL::CString strTitle;
	strTitle.LoadString(IDS_APPLICATION);
	if ( MessageBox(::GetFocus(), strWarning, strTitle, MB_YESNO | MB_ICONWARNING) != IDYES )
	{
		return TRUE;
	}
	CUnitDiskObjectPtr unitDisk = 
		boost::dynamic_pointer_cast<CUnitDiskObject>(obj);
	if ( !unitDisk->CanAccessExclusive() )
	{
		WTL::CString strMsg;
		strMsg.LoadString( IDS_FAIL_TO_ACCESS_EXCLUSIVELY );
		MessageBox( 
			::GetFocus(),
			strMsg,
			strTitle,
			MB_OK | MB_ICONWARNING
			);
		return TRUE;
	}
	try {
		unitDisk->Open( TRUE );
        unitDisk->Initialize( unitDisk );
		unitDisk->CommitDiskInfo();
		unitDisk->Close();
	}
	catch( CNDASException & )
	{
		unitDisk->Close();
		WTL::CString strMsg;
		strMsg.LoadString ( IDS_UIHANDLER_CLEARDIB_FAIL );
		MessageBox( 
			::GetFocus(),
			strMsg,
			strTitle,
			MB_OK | MB_ICONERROR
			);
		return TRUE;
	}
	WTL::CString strMsg;
	strMsg.LoadString( IDS_UIHANDLER_CLEARDIB_SUCCESS );
	return TRUE;
}
开发者ID:yzx65,项目名称:ndas4windows,代码行数:52,代码来源:nbuihandler.cpp

示例4: GetTitle

WTL::CString CObjectUIHandler::GetTitle(CDiskObjectPtr obj) const
{
	WTL::CString strTitle;

	if(obj->IsUnitDisk())
	{
		if(dynamic_cast<CEmptyDiskObject*>(obj.get()) != NULL)
		{
			strTitle.LoadString(IDS_UNIDEV_TYPE_DISK_EMPTY);
		}
		else
		{
			strTitle = obj->GetTitle();
		}
	}
	else
	{
		strTitle = GetType(obj);
	}

	return strTitle;
}
开发者ID:yzx65,项目名称:ndas4windows,代码行数:22,代码来源:nbuihandler.cpp

示例5: GetParentSheet

//////////////////////////////////////////////////////////////////////////
// Page 1
//////////////////////////////////////////////////////////////////////////
LRESULT CDiskPropertyPage1::OnInitDialog(HWND /*hWndFocus*/, LPARAM /*lParam*/)
{
	WTL::CString strCaption;
	strCaption.LoadString(IDS_DISKPROPERTYPAGE_CAPTION);
	GetParent().SetWindowText(strCaption);

	CDiskObjectPtr disk = GetParentSheet()->GetDiskObject();
	const CObjectUIHandler *phandler = CObjectUIHandler::GetUIHandler( disk );
	WTL::CString strText;

	if(disk->IsUnitDisk())
	{
		GetDlgItem(IDC_EDIT_NAME).SetWindowText( disk->GetTitle() );
		GetDlgItem(IDC_EDIT_ID).SetWindowText( 
			phandler->GetStringID(disk) );
	}
	else
	{
		GetDlgItem(IDC_EDIT_NAME).SetWindowText(phandler->GetTitle(disk));
		GetDlgItem(IDC_DEVICE_ID).ShowWindow(SW_HIDE);
		GetDlgItem(IDC_EDIT_ID).ShowWindow(SW_HIDE);
	}

	if ( (disk->GetAccessMask() & GENERIC_WRITE) != 0 )
	{
		strText.LoadString( IDS_DISKPROPERTYPAGE_WRITEKEY_PRESENT );
		GetDlgItem(IDC_EDIT_WRITEKEY).SetWindowText( strText );
	}
	else
	{
		strText.LoadString( IDS_DISKPROPERTYPAGE_WRITEKEY_NOT_PRESENT );
		GetDlgItem(IDC_EDIT_WRITEKEY).SetWindowText( strText );
	}
	WTL::CString strCapacity;
	strCapacity.FormatMessage( 
			IDS_DISKPROPERTYPAGE_SIZE_IN_GB,
			phandler->GetSizeInMB( disk ) / 1024,
			(phandler->GetSizeInMB( disk ) % 1024) / 10 
			);
	GetDlgItem(IDC_EDIT_CAPACITY).SetWindowText( strCapacity );

	//
	// If the object is composite disk with 2 mirrored disk of DIB V1,
	// display 'Migrate' button and message.
	//
	if(!disk->IsUnitDisk() && // bound disk
		disk->GetParent()->IsRoot() && // top disk
		2 == disk->GetDiskCount()) // 2 disks only
	{
		CDiskObjectCompositePtr pDiskObjectComposite = 
            boost::dynamic_pointer_cast<CDiskObjectComposite>(disk);
		if(NMT_MIRROR == pDiskObjectComposite->GetNDASMediaType())
		{
			GetDlgItem(IDC_TEXT_MIGRATE).ShowWindow( SW_SHOW );
			GetDlgItem(IDC_BTN_MIGRATE).ShowWindow( SW_SHOW );
			GetDlgItem(IDC_ST_MIGRATE).ShowWindow( SW_SHOW );
		}
	}

	return 0;
}
开发者ID:yzx65,项目名称:ndas4windows,代码行数:64,代码来源:nbpropertypages.cpp


注:本文中的CDiskObjectPtr::GetTitle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。