本文整理汇总了C++中wtl::CString类的典型用法代码示例。如果您正苦于以下问题:C++ CString类的具体用法?C++ CString怎么用?C++ CString使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CString类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateControls
void CSelectDiskPage::UpdateControls()
{
GetDlgItem(IDC_BTN_ADD).EnableWindow(m_wndListSingle.GetSelectedDiskObjectList().size() > 0);
GetDlgItem(IDC_BTN_REMOVE).EnableWindow(m_wndListBind.GetSelectedDiskObjectList().size() > 0);
GetDlgItem(IDC_BTN_REMOVE_ALL).EnableWindow( m_wndListBind.GetItemCount() > 0 );
CEdit ctlEditCount;
ctlEditCount.Attach(GetDlgItem(IDC_BIND_WIZ_COUNT));
WTL::CString strDiskCount;
strDiskCount.Format(_T("%d"), m_pWizData->m_nDiskCount);
ctlEditCount.SetWindowText(strDiskCount);
CEdit ctlEditSize;
ctlEditSize.Attach(GetDlgItem(IDC_BIND_WIZ_SIZE));
if ( m_wndListBind.GetDiskObjectList().size() == m_pWizData->m_nDiskCount )
{
WTL::CString strSize;
pGetDiskSizeString(
strSize,
m_pWizData->m_nBindType,
m_pWizData->m_nDiskCount,
m_wndListBind.GetSelectedDiskObjectList());
ctlEditSize.SetWindowText(strSize);
SetWizardButtons( PSWIZB_BACK | PSWIZB_NEXT );
}
else
{
ctlEditSize.SetWindowText(_T(""));
SetWizardButtons( PSWIZB_BACK);
}
}
示例2: InitColumn
void CNBListViewCtrl::InitColumn()
{
static COLUMN_INFO column_info[] = {
{ IDS_LISTVIEW_COL_NAME, 120 },
// { IDS_LISTVIEW_COL_ID, 200 },
{ IDS_LISTVIEW_COL_SIZE, 100 }
};
ATLASSERT( m_nColCount <= sizeof(column_info)/sizeof(column_info[0]) );
UINT i, nColCount;
// Clear all the column exist
nColCount = CListViewCtrl::GetHeader().GetItemCount();
for ( i=0; i < nColCount; i++ )
CListViewCtrl::DeleteColumn(0);
// Add new columns
for ( i=0; i < m_nColCount; i++ )
{
WTL::CString strHeader;
strHeader.LoadString( column_info[i].nColHeaderID );
CListViewCtrl::InsertColumn(
i, strHeader, LVCFMT_LEFT,
column_info[i].nWidth, -1 );
}
CRect lvrc;
CListViewCtrl::GetClientRect(lvrc);
CListViewCtrl::SetColumnWidth(1, 70);
CListViewCtrl::SetColumnWidth(0, lvrc.Width() - 70);
}
示例3: CheckCapacityForMirror
BOOL CALLBACK CheckCapacityForMirror(CNBUnitDevice *pUnitDevice, HWND hWnd, LPVOID lpContext)
{
if(!lpContext)
return TRUE;
if(!pUnitDevice)
return FALSE;
CNBLogicalDevice *pLogicalDevice = (CNBLogicalDevice *)lpContext;
for(UINT32 i = 0; i < pLogicalDevice->DevicesTotal(); i++)
{
if ((*pLogicalDevice)[i] &&
(*pLogicalDevice)[i]->GetCapacityInByte() > pUnitDevice->GetCapacityInByte())
{
WTL::CString strMsg;
strMsg.LoadString( IDS_SELECTMIRDLG_SMALLER_DISK );
WTL::CString strTitle;
strTitle.LoadString(IDS_APPLICATION);
MessageBox(
hWnd,
strMsg,
strTitle,
MB_OK | MB_ICONWARNING
);
return FALSE;
}
}
return TRUE;
}
示例4: Start
void CRecoverDlg::Start()
{
WTL::CString strBtnFace;
//
// Launch working thread
//
m_btnOK.EnableWindow(FALSE);
strBtnFace.LoadString( IDS_RECOVER_BTN_CANCEL );
m_btnCancel.SetWindowText( strBtnFace );
m_btnCancel.EnableWindow(FALSE);
m_bRunning = TRUE;
HANDLE hThread;
hThread = CreateThread(
NULL,
0,
ThreadRecover,
this,
NULL, // run immediately
NULL);
if(!hThread)
{
WTL::CString strMsg = _T("");
ShowErrorMessageBox(strMsg);
strBtnFace.LoadString( IDS_RECOVER_BTN_CLOSE );
m_btnCancel.SetWindowText( strBtnFace );
m_bRunning = FALSE;
m_bFinished = TRUE;
}
}
示例5: OnInitDialog
LRESULT CRecoverDlg::OnInitDialog(HWND /*hWndCtl*/, LPARAM /*lParam*/)
{
ATLASSERT( m_pDevice.get() != NULL );
CenterWindow();
m_progBar.SubclassWindow( GetDlgItem(IDC_PROGBAR) );
m_btnOK.Attach( GetDlgItem(IDOK) );
m_btnCancel.Attach( GetDlgItem(IDCANCEL) );
WTL :: CString strBtnFace;
strBtnFace.LoadString( IDS_RECOVER_BTN_CLOSE );
m_btnCancel.SetWindowText( strBtnFace );
DoDataExchange(TRUE);
m_strBindType.LoadString(m_id_bind_type);
m_strDevice = m_pDevice->GetTitle();
DoDataExchange(FALSE);
WTL::CString strCaption;
strCaption.LoadString(m_id_caption);
SetWindowText(strCaption);
SetPhaseText(IDS_RECOVERDLG_PHASE_READY);
if(m_bForceStart)
Start();
return 0;
}
示例6: GetTypeString
WTL::CString CNBUnitDevice::GetTypeString()
{
// AING_TO_DO : Set proper text
WTL::CString strText;
switch(GetType())
{
case NMT_INVALID:
case NMT_SINGLE: strText.LoadString(IDS_LOGDEV_TYPE_SINGLE_DISK); break;
case NMT_MIRROR: strText.LoadString(IDS_LOGDEV_TYPE_SINGLE_DISK); break;
case NMT_SAFE_RAID1: strText.LoadString(IDS_LOGDEV_TYPE_SINGLE_DISK); break;
case NMT_AGGREGATE: strText.LoadString(IDS_LOGDEV_TYPE_SINGLE_DISK); break;
case NMT_RAID0: strText.LoadString(IDS_LOGDEV_TYPE_SINGLE_DISK); break;
case NMT_RAID1: strText.LoadString(IDS_LOGDEV_TYPE_SINGLE_DISK); break;
case NMT_RAID4: strText.LoadString(IDS_LOGDEV_TYPE_SINGLE_DISK); break;
case NMT_AOD: strText.LoadString(IDS_LOGDEV_TYPE_SINGLE_DISK); break;
case NMT_VDVD: strText.LoadString(IDS_LOGDEV_TYPE_SINGLE_DISK); break;
case NMT_CDROM: strText.LoadString(IDS_LOGDEV_TYPE_SINGLE_DISK); break;
case NMT_OPMEM: strText.LoadString(IDS_LOGDEV_TYPE_SINGLE_DISK); break;
case NMT_FLASH: strText.LoadString(IDS_LOGDEV_TYPE_SINGLE_DISK); break;
default:
break;
}
return strText;
}
示例7: GetParentSheet
//////////////////////////////////////////////////////////////////////////
// Page 2
//////////////////////////////////////////////////////////////////////////
LRESULT CDiskPropertyPage2::OnInitDialog(HWND /*hWndFocus*/, LPARAM /*lParam*/)
{
WTL::CString strCaption;
strCaption.LoadString(IDS_DISKPROPERTYPAGE_CAPTION);
GetParentSheet()->SetWindowText(strCaption);
CDiskObjectPtr disk = GetParentSheet()->GetDiskObject();
m_listProperty.SubclassWindow( GetDlgItem(IDC_LIST_PROPERTY) );
DWORD dwStyle = LVS_EX_FULLROWSELECT;
//| LVS_EX_GRIDLINES
//| LVS_EX_INFOTIP
m_listProperty.SetExtendedListViewStyle( dwStyle, dwStyle );
WTL::CString strCol[2];
strCol[0].LoadString( IDS_DISKPROPERTYPAGE_LIST_COL_NAME );
strCol[1].LoadString( IDS_DISKPROPERTYPAGE_LIST_COL_VALUE );
m_listProperty.InsertColumn( 0, strCol[0], LVCFMT_LEFT, 130, -1 );
m_listProperty.InsertColumn( 1, strCol[1], LVCFMT_LEFT, 200, -1 );
const CObjectUIHandler *phandler = CObjectUIHandler::GetUIHandler( disk );
PropertyList propList = phandler->GetPropertyList( disk );
PropertyList::iterator itr;
for ( itr = propList.begin(); itr != propList.end(); ++itr )
{
m_listProperty.InsertItem( itr->strName, itr->strValue, itr->strToolTip );
}
return 0;
}
示例8: ActivateUI
void CMainFrame::ActivateUI(BOOL bActivate)
{
m_wndToolBar.EnableWindow(bActivate);
HMENU hMenu = ATL::CWindow::GetMenu();
if(!hMenu)
return;
UINT uEnableMenuItem = (bActivate) ? MF_ENABLED : MF_GRAYED;
EnableMenuItem(hMenu, IDM_AGGR_REFRESH, uEnableMenuItem);
EnableMenuItem(hMenu, IDM_AGGR_BIND, uEnableMenuItem);
EnableMenuItem(hMenu, IDM_AGGR_UNBIND, uEnableMenuItem);
EnableMenuItem(hMenu, IDM_AGGR_ADDMIRROR, uEnableMenuItem);
EnableMenuItem(hMenu, IDM_AGGR_SYNCHRONIZE, uEnableMenuItem);
EnableMenuItem(hMenu, IDM_AGGR_SINGLE, uEnableMenuItem);
if(bActivate)
{
::SetWindowText(m_hWndStatusBar, _T(""));
}
else
{
WTL::CString strStatusText;
strStatusText.LoadString(IDS_STATUS_REFRESH);
::SetWindowText(m_hWndStatusBar, strStatusText);
}
}
示例9:
BOOL
CRegisterDeviceDialog::IsValidDeviceStringIdKey()
{
// Transfer data from the controls to member variables
DoDataExchange(TRUE);
if (!(m_strDeviceIDs[0].GetLength() == 5 &&
m_strDeviceIDs[1].GetLength() == 5 &&
m_strDeviceIDs[2].GetLength() == 5 &&
m_strDeviceIDs[3].GetLength() == 5 &&
(m_strDeviceKey.GetLength() == 0 || m_strDeviceKey.GetLength() == 5)))
{
return FALSE;
}
WTL::CString strDeviceID;
strDeviceID.Format(TEXT("%s%s%s%s"),
m_strDeviceIDs[0], m_strDeviceIDs[1],
m_strDeviceIDs[2], m_strDeviceIDs[3]);
strDeviceID.MakeUpper();
if (m_strDeviceKey.GetLength() > 0) {
m_strDeviceKey.MakeUpper();
return ::NdasValidateStringIdKeyW(strDeviceID, m_strDeviceKey);
} else {
return ::NdasValidateStringIdKeyW(strDeviceID, NULL);
}
}
示例10: GetStatusString
WTL::CString CNBUnitDevice::GetStatusString()
{
WTL::CString strText;
DWORD status = GetStatus();
if(NDASBIND_UNIT_DEVICE_STATUS_DISCONNECTED & status)
{
strText.LoadString(IDS_STATUS_NOT_CONNECTED);
}
else if(NDASBIND_UNIT_DEVICE_STATUS_MOUNTED & status)
{
strText.LoadString(IDS_STATUS_IN_USE);
}
else if(NDASBIND_UNIT_DEVICE_STATUS_NO_WRITE_KEY & status)
{
strText.LoadString(IDS_STATUS_READ_ONLY);
}
else
{
strText.LoadString(IDS_STATUS_FINE);
}
return strText;
}
示例11: GetStringID
WTL::CString CEmptyDiskUIHandler::GetStringID(CDiskObjectPtr obj) const
{
WTL::CString strDashedID;
strDashedID.LoadString(IDS_UNIDEV_TYPE_DISK_EMPTY);
return strDashedID;
}
示例12: GetName
WTL::CString CNBNdasDevice::GetName()
{
WTL::CString strText;
strText.Format(_T("%s"), m_BaseInfo.szDeviceName);
return strText;
}
示例13:
CMenuIDToStringMap()
{
for ( int i=0; i < sizeof(IDToStrMap)/sizeof(IDToStrMap[0]); i++ )
{
WTL::CString strMenu;
strMenu.LoadString( IDToStrMap[i].nStrID );
insert( std::make_pair(IDToStrMap[i].nID, strMenu) );
}
}
示例14: dlgRecover
BOOL CRAID4DiskUIHandler::OnRecover(CDiskObjectPtr obj) const
{
ATLASSERT( dynamic_cast<CRAID4DiskObject*>(obj.get()) != NULL );
CRAID4DiskObjectPtr raid4Disk =
boost::dynamic_pointer_cast<CRAID4DiskObject>(obj);
if(!raid4Disk->IsDirty())
{
WTL::CString strMsg;
strMsg.LoadString(IDS_WARNING_NOT_NEED_RECOVER );
WTL::CString strTitle;
strTitle.LoadString(IDS_APPLICATION);
MessageBox(
::GetFocus(),
strMsg,
strTitle,
MB_OK | MB_ICONERROR
);
return TRUE;
}
std::list<CDiskObjectPtr>::iterator it;
CUnitDiskObjectPtr pUnitDisk;
it = raid4Disk->begin();
INT32 iDirty;
for(iDirty = raid4Disk->GetDirtyDisk(); iDirty > 0; iDirty--)
it++;
pUnitDisk = boost::dynamic_pointer_cast<CUnitDiskObject>(*it);
CRecoverDlg dlgRecover(FALSE, IDS_LOGDEV_TYPE_DISK_RAID4, IDS_RECOVERDLG_TASK_RECOVER);
dlgRecover.SetMemberDevice(pUnitDisk);
dlgRecover.DoModal();
CNdasHIXChangeNotify HixChangeNotify(pGetNdasHostGuid());
BOOL bResults = HixChangeNotify.Initialize();
if(bResults)
{
NDAS_UNITDEVICE_ID unitDeviceId;
for(it = raid4Disk->begin(); it != raid4Disk->end(); ++it)
{
pUnitDisk = boost::dynamic_pointer_cast<CUnitDiskObject>(*it);
CopyMemory(unitDeviceId.DeviceId.Node,
pUnitDisk->GetLocation()->GetUnitDiskLocation()->MACAddr,
sizeof(unitDeviceId.DeviceId.Node));
unitDeviceId.UnitNo =
pUnitDisk->GetLocation()->GetUnitDiskLocation()->UnitNumber;
HixChangeNotify.Notify(unitDeviceId);
}
}
return TRUE;
}
示例15: 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;
}