本文整理汇总了C++中wtl::CString::Format方法的典型用法代码示例。如果您正苦于以下问题:C++ CString::Format方法的具体用法?C++ CString::Format怎么用?C++ CString::Format使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wtl::CString
的用法示例。
在下文中一共展示了CString::Format方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetName
WTL::CString CNBUnitDevice::GetName()
{
WTL::CString strText;
if(1 != m_pDevice->UnitDevicesCount())
{
strText.Format(_T("%s:%d"), m_pDevice->m_BaseInfo.szDeviceName, m_BaseInfo.UnitNo);
}
else
{
strText.Format(_T("%s"), m_pDevice->m_BaseInfo.szDeviceName);
}
return strText;
}
示例2: 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);
}
}
示例3:
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);
}
}
示例4: i
LRESULT
CRegisterDeviceDialog::
OnInitDialog(HWND hWnd, LPARAM lParam)
{
DWORD nDeviceCount = static_cast<DWORD>(lParam);
//
// Attach controls
//
m_wndStringIDs[0] = CEdit(GetDlgItem(IDC_DEV_ID_1));
m_wndStringIDs[1] = CEdit(GetDlgItem(IDC_DEV_ID_2));
m_wndStringIDs[2] = CEdit(GetDlgItem(IDC_DEV_ID_3));
m_wndStringIDs[3] = CEdit(GetDlgItem(IDC_DEV_ID_4));
m_wndStringKey = GetDlgItem(IDC_DEV_KEY);
m_wndName = GetDlgItem(IDC_DEV_NAME);
m_wndRegister = GetDlgItem(IDC_REGISTER);
//
// chaining paste support
//
DWORD i(0);
for (; i < 3; ++i) {
m_wndPasteChains[i].Attach(m_hWnd, m_wndStringIDs[i], m_wndStringIDs[i+1]);
}
m_wndPasteChains[i].Attach(m_hWnd, m_wndStringIDs[i], NULL);
//
// limit the maximum text
//
m_wndStringIDs[0].SetLimitText(5);
m_wndStringIDs[1].SetLimitText(5);
m_wndStringIDs[2].SetLimitText(5);
m_wndStringIDs[3].SetLimitText(5);
m_wndStringKey.SetLimitText(5);
m_wndName.SetLimitText(32);
//
// default device name
//
WTL::CString strNewDeviceName;
strNewDeviceName.Format(IDS_NEW_DEVICE_NAME_TEMPLATE, nDeviceCount + 1);
m_wndName.SetWindowText(strNewDeviceName);
m_wndName.SetSelAll();
m_wndName.SetFocus();
//
// Centering
//
CenterWindow();
SetMsgHandled(FALSE);
return 0;
}
示例5: OnPaint
void CNBBindListViewCtrl::OnPaint(HDC /*wParam*/)
{
CRect rtCol, rtHeader, rtSubItem;
CHeaderCtrl header = GetHeader();
header.GetWindowRect( rtHeader );
ScreenToClient( rtHeader );
header.GetItemRect( 0, rtCol) ;
rtCol.OffsetRect( rtHeader.TopLeft() );
while ( !m_vtRowHeader.empty() )
{
CCustomStaticCtrl *pWnd = m_vtRowHeader.front();
m_vtRowHeader.pop_front();
pWnd->DestroyWindow();
delete pWnd;
}
// For vertical scroll.
if ( GetItemCount() > 0 )
{
GetSubItemRect(0, 0, LVIR_BOUNDS, rtSubItem);
}
else
{
rtSubItem.top = rtCol.bottom;
}
for ( UINT i=0; i < m_nMaxCount; i++ )
{
CCustomStaticCtrl *pWnd;
CStatic staticCtrl;
pWnd = new CCustomStaticCtrl;
CRect rtItem;
static int nHeight = 14;
rtItem.left = rtCol.left;
rtItem.right = rtCol.right-2;
rtItem.top = rtSubItem.top + i * nHeight;
rtItem.bottom = rtItem.top + nHeight-1;
if ( rtItem.top < rtCol.bottom )
continue;
WTL::CString strTitle;
strTitle.Format(_T("%d"), i);
staticCtrl.Create( m_hWnd, rtItem, strTitle,
WS_CHILD | SS_CENTER | WS_DISABLED);
staticCtrl.ShowWindow( SW_SHOW );
pWnd->SubclassWindow( staticCtrl.m_hWnd );
m_vtRowHeader.push_back( pWnd );
}
DefWindowProc();
}
示例6:
PropertyList CRAID4DiskUIHandler::GetPropertyList(CDiskObjectPtr obj) const
{
PropertyList propList;
PropertyListItem propItem;
WTL::CString strBuffer;
//propItem[0] = _T("Binding type");
propItem.strName.LoadString( IDS_UIHANDLER_PROPERTY_NUM_BOUND_DISK );
strBuffer.Format( _T("%d"), obj->GetDiskCountInBind() );
propItem.strValue = strBuffer;
propItem.strToolTip.LoadString( IDS_UIHANDLER_PROPERTY_NUM_BOUND_DISK_TOOLTIP );
propList.push_back( propItem );
return propList;
}
示例7: RefreshProgBar
void CRecoverDlg::RefreshProgBar(UINT32 nTotalSize, UINT32 nCurrentStep)
{
// Step in progress bar
UINT nNewStep = nCurrentStep;
m_progBar.OnSetPos(0, nCurrentStep, NULL);
nCurrentStep = (!nCurrentStep) ? 1 : nCurrentStep;
// Display time left
time_t timeNow = ::time( NULL );
time_t timeElapsed = timeNow - m_timeBegin;
time_t timeLeft;
if ( timeElapsed != 0
&& m_timePrev != timeNow // To prevent too frequent update
)
{
m_timePrev = timeNow;
// Calculate transfer rate
double fMBPerSecond = ((double)(nCurrentStep * m_nBytesPerBit)) / (1024 * 1024) / timeElapsed;
WTL::CString strMBPerSecond;
strMBPerSecond.Format( _T("%.01f"),fMBPerSecond);
::SetWindowText( GetDlgItem(IDC_TEXT_RATE), strMBPerSecond );
WTL::CString strTimeLeft;
timeLeft = (nTotalSize - nCurrentStep) * (timeElapsed) / (nCurrentStep);
int nHour, nMin, nSec;
nSec = timeLeft % 60;
nMin = (timeLeft / 60) % 60;
nHour = timeLeft / 60 / 60;
strTimeLeft.Format( _T("%02d:%02d:%02d"), nHour, nMin, nSec );
::SetWindowText( GetDlgItem(IDC_TEXT_LEFTTIME), strTimeLeft );
}
}
示例8: GetFaultToleranceString
WTL::CString CNBLogicalDevice::GetFaultToleranceString()
{
WTL::CString strText;
DWORD status = GetFaultTolerance();
if(NDASBIND_LOGICAL_DEVICE_RMD_INVALID & status)
{
strText.LoadString(IDS_FT_NOT_FAULT_TOLERANT);
}
else if(NDASBIND_LOGICAL_DEVICE_RMD_MISSING & status)
{
strText.LoadString(IDS_FT_MISSING);
}
else if(NDASBIND_LOGICAL_DEVICE_RMD_BROKEN & status)
{
strText.LoadString(IDS_FT_FAULT);
}
else if(NDASBIND_LOGICAL_DEVICE_RMD_FAULT & status)
{
strText.LoadString(IDS_FT_DIRTY);
UINT64 SectorsFault;
NDASCOMM_CONNECTION_INFO ci;
AnyUnitDevice()->InitConnectionInfo(&ci, FALSE);
if(NdasOpGetFaultSectorSize(&ci, &SectorsFault))
{
WTL::CString strText2 = strText;
strText.Format(_T("%s(%d%%)"), strText2, 100 - (SectorsFault * SECTOR_SIZE * 100) / AnyUnitDevice()->GetCapacityInByte());
}
}
else
{
strText.LoadString(IDS_FT_FAULT_TOLERANT);
}
return strText;
}
示例9: DetectVersion
DWORD WINAPI CMainDlg::DetectVersion(LPVOID lpParameter)
{
CMainDlg *pThis = static_cast<CMainDlg *> (lpParameter);
WTL::CString result;
const wchar_t *p_versionstr;
const wchar_t *p_versiondat;
const wchar_t *p_term;
DWORD res;
int pos;
pThis->m_edit.AppendText(L"Detecting scan executable\r\n");
pThis->m_process = new Process(L"scan.exe /?");
res = pThis->m_process->Exec(result);
delete pThis->m_process;
pThis->m_process = NULL;
if (res) return -1;
pos = result.Find(L"Scan engine v");
if (pos == -1) /* V2 */
{
p_versionstr = L"McAfee VirusScan Command Line for Win32 Version: ";
p_versiondat = L"Dat set version: ";
p_term = L"\r";
pThis->m_process = new Process(L"scan.exe /version");
res = pThis->m_process->Exec(result);
delete pThis->m_process;
pThis->m_process = NULL;
if (res) return -1;
pos = result.Find(p_versionstr);
if (pos == -1)
{
pThis->m_edit.AppendText(L"Unknown Version\r\n");
return -1;
}
pThis->m_toolversion = 2;
}
else /* V1 */
{
p_versionstr = L"Scan engine v";
p_versiondat = L"Virus data file v";
p_term = L" ";
pThis->m_toolversion = 1;
}
pos += wcslen(p_versionstr);
WTL::CString verstr = result.Mid(pos);
pos = verstr.Find(p_term);
pThis->m_version = verstr.Left(pos);
pos = result.Find(p_versiondat);
if (pos == -1)
{
pThis->m_edit.AppendText(L"Cannot parse dat version\r\n");
return -1;
}
pos += wcslen(p_versiondat);
result = result.Mid(pos);
pThis->m_datversion = _wtoi(result.GetBuffer(0));
WTL::CString message;
message.Format(L"Tool version %s - Dat Version %d\r\n", pThis->m_version, pThis->m_datversion);
pThis->m_edit.AppendText(message);
return 0;
}
示例10: DispathNotification
void CMirrorDlg::DispathNotification()
{
NBSYNC_REPORT report;
report.nSize = sizeof(NBSYNC_REPORT);
CMultithreadedObserver::GerReport( static_cast<NDAS_SYNC_REPORT*>(&report) );
if ( m_nCurrentPhase != report.nPhase )
{
m_nCurrentPhase = report.nPhase;
switch( report.nPhase )
{
case NBSYNC_PHASE_CONNECT:
m_strPhase = _T("Connecting to disks..."); // TODO : String resource
DoDataExchange(FALSE);
break;
case NBSYNC_PHASE_REBIND:
m_strPhase = _T("Updating disk information...");
DoDataExchange(FALSE);
break;
case NBSYNC_PHASE_BIND:
m_strPhase = _T("Writing disk information required for mirroring...");
DoDataExchange(FALSE);
break;
case NBSYNC_PHASE_RETRIVE_BITMAP:
m_strPhase = _T("Retrieving synchronization information..."); // TODO : String resource
DoDataExchange(FALSE);
break;
case NBSYNC_PHASE_SYNCHRONIZE:
m_strPhase = _T("Synchronizing..."); // TODO : String resource
DoDataExchange(FALSE);
break;
case NBSYNC_PHASE_FINISHED:
m_strPhase = _T("Synchronization has finished."); // TODO : String resource
DoDataExchange(FALSE);
m_bFinished = TRUE;
break;
case NBSYNC_PHASE_FAILED:
default:
if ( report.nErrorCode == NBSYNC_ERRORCODE_STOPPED )
{
m_strPhase = _T("Synchronization has been stopped.");
DoDataExchange(FALSE);
}
else
{
m_strPhase = _T("Synchronization has failed.");
DoDataExchange(FALSE);
}
break;
}
if ( report.bRebound && !m_bRebound )
{
boost::dynamic_pointer_cast<CDiskObjectComposite>
(m_pDest->GetParent())->DeleteChild(m_pDest);
if ( m_pMirDisks->front()->IsUsable() )
{
m_pMirDisks->DeleteChild( m_pMirDisks->back() );
}
else
{
m_pMirDisks->DeleteChild( m_pMirDisks->front() );
}
m_pMirDisks->AddChild(m_pMirDisks, m_pDest);
m_bRebound = TRUE;
}
}
// Display process
if ( (m_nCurrentPhase == NBSYNC_PHASE_SYNCHRONIZE
|| m_nCurrentPhase == NBSYNC_PHASE_FINISHED
|| m_nCurrentPhase == NBSYNC_PHASE_FAILED )
&& report.nTotalSize != 0 )
{
// Step in progress bar
UINT nNewStep =
static_cast<UINT>(
(report.nProcessedSize*m_progBar.GetRangeLimit(FALSE))
/ report.nTotalSize
);
while ( m_progBar.GetPos() < nNewStep )
{
m_progBar.StepIt();
}
// Display progressbar message
/*
WTL::CString strProgBarMsg;
strProgBarMsg.Format(
"%d / %d KBs",
static_cast<int>(report.nProcessedSize/2),
static_cast<int>(report.nTotalSize/2));
m_progBar.SetWindowText( strProgBarMsg );
*/
// Display time left
CTime timeNow = CTime::GetCurrentTime();
CTimeSpan timeElapsed = timeNow - m_timeBegin;
CTimeSpan timeLeft;
//.........这里部分代码省略.........