本文整理汇总了C++中CDiskObjectPtr::GetDiskCount方法的典型用法代码示例。如果您正苦于以下问题:C++ CDiskObjectPtr::GetDiskCount方法的具体用法?C++ CDiskObjectPtr::GetDiskCount怎么用?C++ CDiskObjectPtr::GetDiskCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CDiskObjectPtr
的用法示例。
在下文中一共展示了CDiskObjectPtr::GetDiskCount方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: OnMigrate
BOOL CMirDiskUIHandler::OnMigrate(CDiskObjectPtr obj ) const
{
CMirDiskObjectPtr mirDisk =
boost::dynamic_pointer_cast<CMirDiskObject>(obj);
if(NMT_MIRROR != mirDisk->GetNDASMediaType())
return FALSE;
UINT32 BindResult;
CDiskObjectPtr disk = obj;
NDASCOMM_CONNECTION_INFO pConnectionInfo[NUMBER_MIGRATE_DISK];
UINT32 i;
WTL::CString strTitle;
strTitle.LoadString(IDS_APPLICATION);
// Find aggregation root
if (NUMBER_MIGRATE_DISK != disk->GetDiskCount())
{
WTL::CString strMsg;
strMsg.LoadString( IDS_DISKPROPERTYPAGE_MIGRATE_DISK_NOT_EXIST );
MessageBox(
::GetFocus(),
strMsg,
strTitle,
MB_OK | MB_ICONWARNING
);
return FALSE;
}
WTL::CString strConfirmMsg;
strConfirmMsg.LoadString( IDS_DISKPROPERTYPAGE_MIGRATE_CONFIRM );
if ( IDYES != MessageBox(
::GetFocus(),
strConfirmMsg,
strTitle,
MB_YESNO | MB_ICONWARNING
)
)
{
return FALSE;
}
if ( !disk->CanAccessExclusive() )
{
WTL::CString strMsg;
strMsg.LoadString( IDS_FAIL_TO_ACCESS_EXCLUSIVELY );
MessageBox(
::GetFocus(),
strMsg,
strTitle,
MB_OK | MB_ICONWARNING
);
return FALSE;
}
CDiskObjectCompositePtr pDiskObjectComposite =
boost::dynamic_pointer_cast<CDiskObjectComposite>(disk);
CDiskObjectComposite::const_iterator itr;
for (itr = pDiskObjectComposite->begin(), i = 0; itr != pDiskObjectComposite->end(); ++itr, ++i)
{
CUnitDiskObjectPtr unitDisk =
boost::dynamic_pointer_cast<CUnitDiskObject>(*itr);
ZeroMemory(&pConnectionInfo[i], sizeof(NDASCOMM_CONNECTION_INFO));
pConnectionInfo[i].address_type = NDASCOMM_CONNECTION_INFO_TYPE_ADDR_LPX;
pConnectionInfo[i].login_type = NDASCOMM_LOGIN_TYPE_NORMAL;
pConnectionInfo[i].UnitNo = unitDisk->GetLocation()->GetUnitDiskLocation()->UnitNumber;
pConnectionInfo[i].bWriteAccess = TRUE;
pConnectionInfo[i].ui64OEMCode = NULL;
pConnectionInfo[i].bSupervisor = FALSE;
pConnectionInfo[i].protocol = NDASCOMM_TRANSPORT_LPX;
CopyMemory(pConnectionInfo[i].AddressLPX,
unitDisk->GetLocation()->GetUnitDiskLocation()->MACAddr,
LPXADDR_NODE_LENGTH);
}
BindResult = NdasOpBind(NUMBER_MIGRATE_DISK, pConnectionInfo, NMT_RAID1);
WTL :: CString strMsg;
if(NUMBER_MIGRATE_DISK == BindResult)
{
strMsg.LoadString(IDS_DISKPROPERTYPAGE_MIGRATE_SUCCESS);
WTL::CString strTitle;
strTitle.LoadString(IDS_APPLICATION);
MessageBox(
::GetFocus(),
strMsg,
strTitle,
MB_OK|MB_ICONINFORMATION
);
}
else
{
DWORD dwLastError = ::GetLastError();
switch(dwLastError)
{
case NDASCOMM_ERROR_RW_USER_EXIST:
case NDASOP_ERROR_ALREADY_USED:
case NDASOP_ERROR_DEVICE_FAIL:
//.........这里部分代码省略.........
示例3: HixChangeNotify
void CDiskPropertyPage1::OnMigrate(UINT /*wNotifyCode*/, int /*wID*/, HWND /*hwndCtl*/)
{
UINT32 BindResult;
CDiskObjectPtr disk = GetParentSheet()->GetDiskObject();
NDAS_CONNECTION_INFO pConnectionInfo[NUMBER_MIGRATE_DISK];
UINT32 i;
WTL::CString strTitle;
strTitle.LoadString(IDS_APPLICATION);
// Find aggregation root
if (NUMBER_MIGRATE_DISK != disk->GetDiskCount())
{
WTL::CString strMsg;
strMsg.LoadString( IDS_DISKPROPERTYPAGE_MIGRATE_DISK_NOT_EXIST );
MessageBox(
strMsg,
strTitle,
MB_OK | MB_ICONWARNING
);
return;
}
WTL::CString strConfirmMsg;
strConfirmMsg.LoadString( IDS_DISKPROPERTYPAGE_MIGRATE_CONFIRM );
if ( IDYES != MessageBox(
strConfirmMsg,
strTitle,
MB_YESNO | MB_ICONWARNING
)
)
{
return;
}
if ( !disk->CanAccessExclusive() )
{
WTL::CString strMsg;
strMsg.LoadString( IDS_DISKPROPERTYPAGE_MIGRATE_ACCESS_FAIL );
MessageBox(
strMsg,
strTitle,
MB_OK | MB_ICONWARNING
);
return;
}
CDiskObjectCompositePtr pDiskObjectComposite =
boost::dynamic_pointer_cast<CDiskObjectComposite>(disk);
CDiskObjectComposite::const_iterator itr;
for (itr = pDiskObjectComposite->begin(), i = 0; itr != pDiskObjectComposite->end(); ++itr, ++i)
{
CUnitDiskObjectPtr unitDisk =
boost::dynamic_pointer_cast<CUnitDiskObject>(*itr);
pConnectionInfo[i].type = NDAS_CONNECTION_INFO_TYPE_MAC_ADDRESS;
pConnectionInfo[i].UnitNo = unitDisk->GetLocation()->GetUnitDiskLocation()->UnitNumber;
pConnectionInfo[i].bWriteAccess = TRUE;
pConnectionInfo[i].ui64OEMCode = NULL;
pConnectionInfo[i].protocol = IPPROTO_LPXTCP;
CopyMemory(pConnectionInfo[i].MacAddress,
unitDisk->GetLocation()->GetUnitDiskLocation()->MACAddr,
LPXADDR_NODE_LENGTH);
}
BindResult = NdasOpBind(NUMBER_MIGRATE_DISK, pConnectionInfo, NMT_RAID1);
WTL :: CString strMsg;
if(NUMBER_MIGRATE_DISK == BindResult)
{
strMsg.LoadString(IDS_DISKPROPERTYPAGE_MIGRATE_SUCCESS);
WTL::CString strTitle;
strTitle.LoadString(IDS_APPLICATION);
MessageBox(
strMsg,
strTitle,
MB_OK|MB_ICONINFORMATION
);
GetDlgItem(IDC_TEXT_MIGRATE).ShowWindow( SW_HIDE );
GetDlgItem(IDC_BTN_MIGRATE).ShowWindow( SW_HIDE );
GetDlgItem(IDC_ST_MIGRATE).ShowWindow( SW_HIDE );
}
else
{
DWORD dwLastError = ::GetLastError();
switch(dwLastError)
{
case NDASCOMM_ERROR_RW_USER_EXIST:
case NDASOP_ERROR_ALREADY_USED:
case NDASOP_ERROR_DEVICE_FAIL:
case NDASOP_ERROR_NOT_SINGLE_DISK:
case NDASOP_ERROR_DEVICE_UNSUPPORTED:
case NDASOP_ERROR_NOT_BOUND_DISK: // does not return this error
for (itr = pDiskObjectComposite->begin(), i = 0; itr != pDiskObjectComposite->end(); ++itr, ++i)
{
CUnitDiskObjectPtr unitDisk =
boost::dynamic_pointer_cast<CUnitDiskObject>(*itr);
if(BindResult == i)
//.........这里部分代码省略.........