本文整理汇总了C++中CNBLogicalDevice::GetType方法的典型用法代码示例。如果您正苦于以下问题:C++ CNBLogicalDevice::GetType方法的具体用法?C++ CNBLogicalDevice::GetType怎么用?C++ CNBLogicalDevice::GetType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CNBLogicalDevice
的用法示例。
在下文中一共展示了CNBLogicalDevice::GetType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnUnBind
void CMainFrame::OnUnBind(UINT wNotifyCode, int wID, HWND hwndCtl)
{
CNBDevice *pDevice = m_viewTreeList.GetSelectedDevice();
if(!pDevice)
return;
if(!pDevice->GetCommandAbility(wID))
return;
CNBLogicalDevice *pLogicalDevice = dynamic_cast<CNBLogicalDevice *>(pDevice);
if(!pLogicalDevice)
return;
BOOL bUnbindMirror =
(NMT_RAID1 == pLogicalDevice->GetType() ||
NMT_RAID1R == pLogicalDevice->GetType() ||
NMT_MIRROR == pLogicalDevice->GetType());
// warning message
CString strMsg;
NBUnitDevicePtrList listUnitDevices = pLogicalDevice->GetOperatableDevices();
CNBSelectDeviceDlg dlgSelectDevice(
IDD_DEVICE_LIST,
IDS_UNBIND_DLG_CAPTION,
(bUnbindMirror) ? IDS_WARNING_UNBIND_MIR : IDS_WARNING_UNBIND,
listUnitDevices,
0,
NULL,
NULL);
if(dlgSelectDevice.DoModal() != IDOK)
return;
NDASCOMM_CONNECTION_INFO *ci = new NDASCOMM_CONNECTION_INFO[listUnitDevices.size()];
UINT32 i = 0;
for(NBUnitDevicePtrList::iterator itUnitDevice = listUnitDevices.begin();
itUnitDevice != listUnitDevices.end(); i++, itUnitDevice++)
{
(*itUnitDevice)->InitConnectionInfo(&ci[i], TRUE);
}
AutoCursor l_auto_cursor(IDC_WAIT);
UINT32 BindResult = NdasOpBind(listUnitDevices.size(), ci, NMT_SINGLE, 0);
l_auto_cursor.Release();
DWORD dwLastError = ::GetLastError();
if(i == BindResult)
{
CString strTitle;
strTitle.LoadString(IDS_APPLICATION);
strMsg.LoadString(
(bUnbindMirror) ? IDS_WARNING_UNBIND_AFTER_MIR :
IDS_WARNING_UNBIND_AFTER);
MessageBox(
strMsg,
strTitle,
MB_OK|MB_ICONINFORMATION
);
}
else
{
::SetLastError(dwLastError);
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
if(BindResult < listUnitDevices.size())
{
i = 0;
for(NBUnitDevicePtrList::iterator itUnitDevice = listUnitDevices.begin();
itUnitDevice != listUnitDevices.end(); i++, itUnitDevice++)
{
if(i == BindResult)
strMsg.FormatMessage(IDS_BIND_FAIL_AT_SINGLE_NDAS_FMT, (*itUnitDevice)->GetName());
}
}
else
strMsg.LoadString(IDS_BIND_FAIL);
break;
default:
strMsg.LoadString(IDS_BIND_FAIL);
break;
}
ShowErrorMessageBox(IDS_MAINFRAME_SINGLE_ACCESS_FAIL);
}
//.........这里部分代码省略.........
示例2: OnMigrate
void CMainFrame::OnMigrate(UINT wNotifyCode, int wID, HWND hwndCtl)
{
CNBDevice *pDevice = m_viewTreeList.GetSelectedDevice();
if(!pDevice)
return;
if(!pDevice->GetCommandAbility(wID))
return;
CNBLogicalDevice *pLogicalDevice = dynamic_cast<CNBLogicalDevice *>(pDevice);
if(!pLogicalDevice)
return;
if (NMT_MIRROR != pLogicalDevice->GetType() &&
NMT_RAID1 != pLogicalDevice->GetType() &&
NMT_RAID4 != pLogicalDevice->GetType())
return;
// warning message
CString strMsg;
NBUnitDevicePtrList listUnitDevices = pLogicalDevice->GetOperatableDevices();
CNBSelectDeviceDlg dlgSelectDevice(
IDD_DEVICE_LIST,
IDS_MIGRATE_DLG_CAPTION,
IDS_MIGRATE_DLG_MESSAGE,
listUnitDevices,
0,
NULL,
NULL);
if(dlgSelectDevice.DoModal() != IDOK)
return;
NDASCOMM_CONNECTION_INFO *ci = new NDASCOMM_CONNECTION_INFO[listUnitDevices.size()];
UINT32 i = 0;
for(NBUnitDevicePtrList::iterator itUnitDevice = listUnitDevices.begin();
itUnitDevice != listUnitDevices.end(); i++, itUnitDevice++)
{
(*itUnitDevice)->InitConnectionInfo(&ci[i], TRUE);
}
AutoCursor l_auto_cursor(IDC_WAIT);
BOOL bResult = NdasOpMigrate(&ci[0]);
l_auto_cursor.Release();
DWORD dwLastError = ::GetLastError();
if(!bResult)
{
ShowErrorMessageBox(IDS_MAINFRAME_SINGLE_ACCESS_FAIL);
}
for(NBUnitDevicePtrList::iterator itUnitDevice = listUnitDevices.begin();
itUnitDevice != listUnitDevices.end(); i++, itUnitDevice++)
{
(*itUnitDevice)->HixChangeNotify(pGetNdasHostGuid());
}
delete [] ci;
OnRefreshStatus(NULL, NULL, NULL);
return;
}