本文整理汇总了C++中NBUnitDevicePtrList::end方法的典型用法代码示例。如果您正苦于以下问题:C++ NBUnitDevicePtrList::end方法的具体用法?C++ NBUnitDevicePtrList::end怎么用?C++ NBUnitDevicePtrList::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NBUnitDevicePtrList
的用法示例。
在下文中一共展示了NBUnitDevicePtrList::end方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例3: HixChangeNotify
// 0 to automatically advance to the next page
// -1 to prevent the page from changing
INT
CSelectDiskPage::OnWizardNext()
{
ATLASSERT( m_wndListBind.GetItemCount() == (int)m_pWizData->m_nDiskCount);
ATLASSERT(
NMT_AGGREGATE == m_pWizData->m_nBindType ||
NMT_RAID0 == m_pWizData->m_nBindType ||
NMT_RAID1 == m_pWizData->m_nBindType ||
NMT_RAID4 == m_pWizData->m_nBindType);
NBUnitDevicePtrList listBind;
unsigned int i;
UINT32 BindResult;
WTL::CString strMsg;
// warning message
{
WTL::CString strTitle;
strTitle.LoadString(IDS_APPLICATION);
strMsg.LoadString(IDS_WARNING_BIND);
int id = MessageBox(
strMsg,
strTitle,
MB_YESNO|MB_ICONEXCLAMATION
);
if(IDYES != id)
return -1;
}
m_pWizData->listUnitDevicesBind = m_wndListBind.GetDiskObjectList();
NDASCOMM_CONNECTION_INFO *pConnectionInfo;
pConnectionInfo = new NDASCOMM_CONNECTION_INFO[m_pWizData->m_nDiskCount];
ZeroMemory(pConnectionInfo, sizeof(NDASCOMM_CONNECTION_INFO) * m_pWizData->m_nDiskCount);
listBind = m_wndListBind.GetDiskObjectList();
WTL::CString strTitle;
CNBUnitDevice *UnitDiskObject;
NBUnitDevicePtrList::const_iterator itr;
for (i = 0, itr = listBind.begin(); itr != listBind.end(); ++itr, i++ )
{
UnitDiskObject = *itr;
if(!UnitDiskObject->InitConnectionInfo(&pConnectionInfo[i], TRUE))
// if(!((*itr)->GetAccessMask() & GENERIC_WRITE))
{
// "%1!s! does not have a write access privilege. You need to set write key to this NDAS device before this action."
strMsg.FormatMessage(IDS_ERROR_NOT_REGISTERD_WRITE_FMT,
(*itr)->GetName()
);
strTitle.LoadString(IDS_APPLICATION);
MessageBox(
strMsg,
strTitle,
MB_OK|MB_ICONERROR
);
delete [] pConnectionInfo;
return -1;
}
}
m_pWizData->m_BindResult = NdasOpBind(
m_pWizData->m_nDiskCount, pConnectionInfo, m_pWizData->m_nBindType);
if(m_pWizData->m_BindResult != m_pWizData->m_nDiskCount) // error
m_pWizData->dwBindLastError = ::GetLastError();
CNdasHIXChangeNotify HixChangeNotify(pGetNdasHostGuid());
BOOL bResults = HixChangeNotify.Initialize();
if(bResults)
{
for (i = 0; i < m_pWizData->m_nDiskCount; i++ )
{
NDAS_UNITDEVICE_ID unitDeviceId;
CopyMemory(unitDeviceId.DeviceId.Node, pConnectionInfo[i].AddressLPX,
sizeof(unitDeviceId.DeviceId.Node));
unitDeviceId.UnitNo = pConnectionInfo[i].UnitNo;
HixChangeNotify.Notify(unitDeviceId);
}
}
delete [] pConnectionInfo;
return 0;
}
示例4: l_auto_cursor
// 0 to automatically advance to the next page
// -1 to prevent the page from changing
INT
CSelectDiskPage::OnWizardNext()
{
ATLASSERT( m_wndListBind.GetItemCount() == (int)m_pWizData->m_nDiskCount);
ATLASSERT(
NMT_AGGREGATE == m_pWizData->m_nBindType ||
NMT_RAID0 == m_pWizData->m_nBindType ||
NMT_RAID1R3 == m_pWizData->m_nBindType ||
NMT_RAID4R3 == m_pWizData->m_nBindType ||
NMT_RAID5 == m_pWizData->m_nBindType
);
NBUnitDevicePtrList listBind;
unsigned int i;
CString strMsg;
// Warning message if disk is over 2T.
{
UINT64 nSize = pGetBoundDiskSize(
m_pWizData->m_nBindType,
m_pWizData->m_nDiskCount,
m_wndListBind.GetDiskObjectList());
if (nSize >= 2LL * 1024 * 1024 * 1024 * 1024) { // 2 Tera.
CString strTitle;
strTitle.LoadString(IDS_APPLICATION);
strMsg.LoadString(IDS_WARNING_BIND_SIZE);
int id = MessageBox(
strMsg,
strTitle,
MB_YESNO|MB_ICONEXCLAMATION
);
if(IDYES != id)
return -1;
}
}
// warning message
{
CString strTitle;
strTitle.LoadString(IDS_APPLICATION);
strMsg.LoadString(IDS_WARNING_BIND);
int id = MessageBox(
strMsg,
strTitle,
MB_YESNO|MB_ICONEXCLAMATION
);
if(IDYES != id)
return -1;
}
m_pWizData->listUnitDevicesBind = m_wndListBind.GetDiskObjectList();
NDASCOMM_CONNECTION_INFO *pConnectionInfo;
pConnectionInfo = new NDASCOMM_CONNECTION_INFO[m_pWizData->m_nDiskCount];
ZeroMemory(pConnectionInfo, sizeof(NDASCOMM_CONNECTION_INFO) * m_pWizData->m_nDiskCount);
listBind = m_wndListBind.GetDiskObjectList();
CString strTitle;
CNBUnitDevice *UnitDiskObject;
NBUnitDevicePtrList::const_iterator itr;
for (i = 0, itr = listBind.begin(); itr != listBind.end(); ++itr, i++ )
{
UnitDiskObject = *itr;
if(!UnitDiskObject->InitConnectionInfo(&pConnectionInfo[i], TRUE))
// if(!((*itr)->GetAccessMask() & GENERIC_WRITE))
{
// "%1!s! does not have a write access privilege. You need to set write key to this NDAS device before this action."
strMsg.FormatMessage(IDS_ERROR_NOT_REGISTERD_WRITE_FMT,
(*itr)->GetName()
);
strTitle.LoadString(IDS_APPLICATION);
MessageBox(
strMsg,
strTitle,
MB_OK|MB_ICONERROR);
delete [] pConnectionInfo;
return -1;
}
}
DWORD dwUserSpace = 0;
if(!pGetAppConfigValue(_T("UserSpace"), &dwUserSpace))
{
dwUserSpace = 0;
}
AutoCursor l_auto_cursor(IDC_WAIT);
m_pWizData->m_BindResult = NdasOpBind(
m_pWizData->m_nDiskCount, pConnectionInfo, m_pWizData->m_nBindType, dwUserSpace);
l_auto_cursor.Release();
if(m_pWizData->m_BindResult != m_pWizData->m_nDiskCount) // error
m_pWizData->dwBindLastError = ::GetLastError();
//.........这里部分代码省略.........