本文整理汇总了C++中CString::LoadStringW方法的典型用法代码示例。如果您正苦于以下问题:C++ CString::LoadStringW方法的具体用法?C++ CString::LoadStringW怎么用?C++ CString::LoadStringW使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CString
的用法示例。
在下文中一共展示了CString::LoadStringW方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnConnectStateChanged
LRESULT MainDlg::OnConnectStateChanged(WPARAM wParam, LPARAM lParam)
{
ConnectState state = DeviceProxy::GetInstance()->GetConnectState();
if (state == STATE_DEVICE_CLOSED)
{
// 按钮状态
m_connectStateChkBtn.SetCheck(0);
m_connectStateChkBtn.SetWindowText(_T("启动验钞机"));
// 状态栏提示
CString str;
str.LoadStringW(IDS_DEVICE_CLOSED);
m_statusBar.SetPanel(STATUSBAR_CONNECT_STATE, str, IDB_RED_CIRCLE);
}
else if (state == STATE_DEVICE_UNCONNECTED)
{
DeviceProxy::GetInstance()->Stop();
}
else if (state == STATE_DEVICE_CONNECTED)
{
// 状态栏提示
CString str;
str.LoadStringW(IDS_DEVICE_CONNECTED);
m_statusBar.SetPanel(STATUSBAR_CONNECT_STATE, str, IDB_GREEN_CIRCLE);
}
else if (state == STATE_DEVICE_LISTENING)
{
// 状态栏提示
CString str;
str.LoadStringW(IDS_DEVICE_LISTENING);
m_statusBar.SetPanel(STATUSBAR_CONNECT_STATE, str, IDB_GREEN_CIRCLE);
}
return TRUE;
}
示例2: throttleString
//------------------------------------------------------------------
// convert CPU policy setting to string
//------------------------------------------------------------------
CString throttleString( UCHAR throttle )
{
static CString s1, s2, s3, s4, s5;
static boolean init = false;
if( !init )
{
s1.LoadStringW( IDS_MAIN56 );
s2.LoadStringW( IDS_MAIN57 );
s3.LoadStringW( IDS_MAIN58 );
s4.LoadStringW( IDS_MAIN59 );
s5.LoadStringW( IDS_SW7 );
init = true;
}
switch( throttle )
{
case PO_THROTTLE_NONE: return s1;
case PO_THROTTLE_CONSTANT: return s2;
case PO_THROTTLE_DEGRADE: return s3;
case PO_THROTTLE_ADAPTIVE: return s4;
}
return s5;
}
示例3: pwrAction
//------------------------------------------------------------------
// power action to string
//------------------------------------------------------------------
CString pwrAction( POWER_ACTION action )
{
static CString s1, s2, s3, s4, s5, s6, s7, s8, s9;
static boolean init = false;
if( !init )
{
s1.LoadStringW( IDS_SW16 );
s2.LoadStringW( IDS_SW17 );
s3.LoadStringW( IDS_SW18 );
s4.LoadStringW( IDS_SW19 );
s5.LoadStringW( IDS_SW20 );
s6.LoadStringW( IDS_SW21 );
s7.LoadStringW( IDS_SW22 );
s8.LoadStringW( IDS_SW23 );
s9.LoadStringW( IDS_SW7 );
init = true;
}
switch( action )
{
case PowerActionNone: return s1; //_T("No action");
case PowerActionReserved: return s2; //_T("(reserved setting)");
case PowerActionSleep: return s3; //_T("Sleep");
case PowerActionHibernate: return s4; //_T("Hibernate");
case PowerActionShutdown: return s5; //_T("Shutdown");
case PowerActionShutdownReset: return s6; //_T("Shutdown and reset");
case PowerActionShutdownOff: return s7; //_T("Shutdown and power off");
case PowerActionWarmEject: return s8; //_T("Warm eject");
}
return s9; //_T("(UNKNOWN)");
}
示例4: sysPwrState
//------------------------------------------------------------------
// power state to string
//------------------------------------------------------------------
CString sysPwrState( SYSTEM_POWER_STATE state )
{
static CString s1, s2, s3, s4, s5, s6, s7, s8, s9;
static boolean init = false;
if( !init )
{
s1.LoadStringW( IDS_SW8 );
s2.LoadStringW( IDS_SW9 );
s3.LoadStringW( IDS_SW10 );
s4.LoadStringW( IDS_SW11 );
s5.LoadStringW( IDS_SW12 );
s6.LoadStringW( IDS_SW13 );
s7.LoadStringW( IDS_SW14 );
s8.LoadStringW( IDS_SW15 );
s9.LoadStringW( IDS_SW7 );
init = true;
}
switch( state )
{
case PowerSystemUnspecified: return s1; //_T("No wake up when lid opened");
case PowerSystemWorking: return s2; //_T("S0");
case PowerSystemSleeping1: return s3; //_T("S1");
case PowerSystemSleeping2: return s4; //_T("S2");
case PowerSystemSleeping3: return s5; //_T("S3");
case PowerSystemHibernate: return s6; //_T("S4 (Hibernate)");
case PowerSystemShutdown: return s7; //_T("S5 (Off)");
case PowerSystemMaximum: return s8; //_T("???");
}
return s9; //_T("(UNKNOWN)");
}
示例5: DrawTitleText
void CStartupView::DrawTitleText(Gdiplus::Graphics &graphics)
{
Gdiplus::Rect gdipRcLeftButtons;
CalculateLeftButtonsRegion(gdipRcLeftButtons);
Gdiplus::SolidBrush blackBrush(Gdiplus::Color(255, 0, 0, 0));
Gdiplus::Font titleFont(m_csFontFamily, m_iTitleFontSize,
Gdiplus::FontStyleBold, Gdiplus::UnitPixel);
Gdiplus::Font subTitleFont(m_csFontFamily, m_iNormalFontSize,
Gdiplus::FontStyleBold, Gdiplus::UnitPixel);
CString csRecord1;
csRecord1.LoadString(IDS_RECORD);
INT x = gdipRcLeftButtons.X;
INT y = gdipRcLeftButtons.Y + 2*BUTTON_TITLE_HEIGHT;
Gdiplus::PointF textOrigin(x/*gdipRcLeftButtons.X*/, y/*(gdipRcLeftButtons.Y + gdipRcLeftButtons.Height)*/ );
graphics.SetTextRenderingHint(Gdiplus::TextRenderingHintAntiAliasGridFit);
graphics.DrawString(csRecord1, csRecord1.GetLength(), &titleFont, textOrigin, &blackBrush);
x = gdipRcLeftButtons.X;
y = gdipRcLeftButtons.Y + BUTTON_TITLE_HEIGHT + 2*BUTTON_SUBTITLE_HEIGHT + 2*(BUTTON_HEIGHT1 + 10) + SEPARATOR_HEIGHT + 5;
//Gdiplus::PointF textOrigin(x/*gdipRcLeftButtons.X*/, y/*(gdipRcLeftButtons.Y + gdipRcLeftButtons.Height)*/ );
textOrigin.X = x;
textOrigin.Y = y;
CString csWelcome;
//csWelcome.LoadStringW(IDS_WELCOME);
csWelcome.LoadStringW(ID_MENU_NEW);
graphics.DrawString(csWelcome, csWelcome.GetLength(), &titleFont, textOrigin, &blackBrush);
textOrigin.Y += BUTTON_TITLE_HEIGHT;
Gdiplus::Rect gdipRcRightButtons;
CalculateRightButtonsRegion(gdipRcRightButtons);
textOrigin.X = gdipRcRightButtons.X ;
textOrigin.Y = gdipRcRightButtons.Y + BUTTON_TITLE_HEIGHT + BUTTON_HEIGHT;;
CString csRecord;
//csRecord.LoadStringW(IDS_RECORD);
csRecord.LoadStringW(ID_MENU_OPEN);
graphics.DrawString(csRecord, csRecord.GetLength(), &titleFont, textOrigin, &blackBrush);
/*textOrigin.X = gdipRcRightButtons.X ;
textOrigin.Y += 3*BUTTON_HEIGHT;
CString csRecent;
csRecent.LoadStringW(IDS_RECENTLY_OPENED_PROJECTS);
graphics.DrawString(csRecent, csRecent.GetLength(), &titleFont, textOrigin, &blackBrush); */
}
示例6: OnInitDialog
BOOL CDlgFtch::OnInitDialog()
{
CDialog::OnInitDialog();
CString str;
str.LoadStringW(IDS_STRING9030);
GetDlgItem(IDC_STATIC_EDIT1)->SetWindowText(str);
str.LoadStringW(IDS_STRING9031);
this->SetWindowTextW(str);
this->MoveWindow(0,0,625,90);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
示例7: OnInitDialog
BOOL MainDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// 设置此对话框的图标。 当应用程序主窗口不是对话框时,框架将自动
// 执行此操作
SetIcon(m_hIcon, TRUE); // 设置大图标
SetIcon(m_hIcon, FALSE); // 设置小图标
// TODO: 在此添加额外的初始化代码
// 状态栏
m_statusBar.Create(this, IDC_PLACE_STATUS);
CString str;
str.LoadStringW(IDS_DEVICE_CLOSED);//初始状态显示关闭
m_statusBar.AddPanel(STATUSBAR_CONNECT_STATE, str, IDB_RED_CIRCLE, StatusBar::PANEL_ALIGN_RIGHT);
str = "版本: ";
str += ConfigBlock::GetInstance()->GetStringParameter(L"DeviceInfo", L"firmwareVersion", L"");
m_statusBar.AddPanel(STATUSBAR_DEVICE_INFO, str, NULL, StatusBar::PANEL_ALIGN_RIGHT);
// 点钞机状态按钮
m_connectStateChkBtn.SetCheck(0);
m_connectStateChkBtn.SetWindowText(_T("启动点钞机"));
// 布局
m_layout.Init(m_hWnd);
m_layout.AddAnchor(m_statusBar.m_hWnd, AnchorLayout::BOTTOM_LEFT, AnchorLayout::BOTTOM_RIGHT);
m_layout.AddDlgItem(IDC_EDIT_TIPS, AnchorLayout::BOTTOM_LEFT, AnchorLayout::BOTTOM_RIGHT);
m_layout.AddDlgItem(IDC_STATIC_TIPS, AnchorLayout::BOTTOM_LEFT, AnchorLayout::BOTTOM_LEFT);
// 显示
ShowWindow(SW_SHOW);
return TRUE; // 除非将焦点设置到控件,否则返回 TRUE
}
示例8: setContactType
void Contact::setContactType(int type)
{
if(type < 0 || type > 2)
{
//throw new Error or smth...
return;
}
tipContactKey = type;
CString strTip;
switch(type)
{
case Contact::FRIEND:
strTip.LoadStringW(IDS_STRING132);
break;
case Contact::COLLEAGUE:
strTip.LoadStringW(IDS_STRING133);
break;
case Contact::ACQUAINTANCE:
strTip.LoadStringW(IDS_STRING134);
break;
}
setContactType(strTip);
}
示例9: DynamicLoadIcon
/*++
* @name DynamicLoadIcon
*
* Returns the respective icon as per the current battery capacity.
* It also does the work of setting global parameters of battery capacity and tooltips.
*
* @param hinst
* A handle to a instance of the module.
*
* @return The handle to respective battery icon.
*
*--*/
static HICON DynamicLoadIcon(HINSTANCE hinst)
{
SYSTEM_POWER_STATUS PowerStatus;
HICON hBatIcon;
UINT index = -1;
if (!GetSystemPowerStatus(&PowerStatus) ||
PowerStatus.ACLineStatus == AC_LINE_UNKNOWN ||
PowerStatus.BatteryFlag == BATTERY_FLAG_UNKNOWN)
{
hBatIcon = LoadIcon(hinst, MAKEINTRESOURCE(IDI_BATTCAP_ERR));
g_strTooltip.LoadStringW(IDS_PWR_UNKNOWN_REMAINING);
return hBatIcon;
}
if (((PowerStatus.BatteryFlag & BATTERY_FLAG_NO_BATTERY) == 0) &&
((PowerStatus.BatteryFlag & BATTERY_FLAG_CHARGING) == BATTERY_FLAG_CHARGING))
{
index = Quantize(PowerStatus.BatteryLifePercent);
hBatIcon = LoadIcon(hinst, MAKEINTRESOURCE(bc_icons[index]));
g_strTooltip.Format(IDS_PWR_CHARGING, PowerStatus.BatteryLifePercent);
}
else if (((PowerStatus.BatteryFlag & BATTERY_FLAG_NO_BATTERY) == 0) &&
((PowerStatus.BatteryFlag & BATTERY_FLAG_CHARGING) == 0))
{
index = Quantize(PowerStatus.BatteryLifePercent);
hBatIcon = LoadIcon(hinst, MAKEINTRESOURCE(br_icons[index]));
g_strTooltip.Format(IDS_PWR_PERCENT_REMAINING, PowerStatus.BatteryLifePercent);
}
else
{
hBatIcon = LoadIcon(hinst, MAKEINTRESOURCE(IDI_POWER_AC));
g_strTooltip.LoadStringW(IDS_PWR_AC);
}
return hBatIcon;
}
示例10: CFigureObject
// The constructor
//
CArmyCardSgtDrakeAlexander::CArmyCardSgtDrakeAlexander()
:
// Call the base constructor
CArmyCard()
{
// The name of the card
m_Name.LoadString(IDS_SGTDRAKEALEXANDERNAME);
// The basic rule text
//m_BasicText.LoadStringW(IDS_);
// The basic rule movement
m_BasicMovementSpace = 5;
// The basic range
m_BasicRangeSpace = 1;
// The basic rule attack
m_BasicAttackDice = 3;
// The basic rule defense
m_BasicDefenseDice = 6;
// The expert rule text
//m_ExpertText.LoadStringW(IDS_);
// The expert rule movement
m_ExpertMovementSpace = 5;
// The expert rule range
m_ExpertRangeSpace = 1;
// The expert rule attack
m_ExpertAttackDice = 3;
// The expert rule defense
m_ExpertDefenseDice = 4;
// The expert rule cost point
m_ExpertCostPoint = 80;
// The expert rule total life point
m_ExpertTotalLifePoint = 4;
// The current life point
m_CurrentLifePoint = m_ExpertTotalLifePoint;
// The ability to fly
m_CanFly = false;
// The bitmap file name
m_BitmapFileName = _T("Sgt_Drake_Alexander");
// The figures list
CString Str;
Str.LoadStringW( IDS_SGTDRAKEALEXANDER );
CFigureObject* pFigureObject = new CFigureObject( false, Str, _T("SGT DRAKE ALEXANDER"), this );
m_Figures.Add( pFigureObject );
}
示例11: OnCreate
// At the creation
//
int CInfoListBar::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CSizingControlBar::OnCreate(lpCreateStruct) == -1)
return -1;
if (!m_wndMyListCtrl.Create(LVS_REPORT|WS_CHILD|WS_VISIBLE|WS_BORDER|LVS_SINGLESEL|LVS_OWNERDRAWFIXED,CRect(0,0,0,0), this, 30003))
return -1;
if( !m_wndIcon.Create(NULL,SS_BITMAP|WS_CHILD|WS_VISIBLE,CRect(0,0,110,100), this, 2))
return -1;
m_bmp.LoadBitmap(IDB_INFOLIST);
m_wndIcon.SetBitmap( (HBITMAP) m_bmp );
CString StrResource;
StrResource.LoadString( IDS_INFOBAR );
if( !m_wndText.Create( StrResource ,WS_CHILD|WS_VISIBLE,CRect(0,0,0,0), this, 3))
return -1;
if (!m_font.CreateStockObject(DEFAULT_GUI_FONT))
if (!m_font.CreatePointFont(80, _T("MS Sans Serif")))
return -1;
m_wndText.SetFont(&m_font);
// Define the minimum size of this window
m_szMin.cx = 110;
m_szMin.cy = 100;
m_ImageList.Create( IDB_IMAGELIST_INFO, 16, 3, RGB(255,0,255) );
m_wndMyListCtrl.SetSpecialList( true );
m_wndMyListCtrl.SetImageList( &m_ImageList, LVSIL_SMALL );
CString Str;
Str.LoadStringW( IDS_INFO_COLUMN );
CGlobalIHM::CreateColumnListCtrl( &m_wndMyListCtrl, Str );
LVCOLUMN Column;
Column.mask = LVCF_FMT;
Column.fmt = LVCFMT_CENTER;
m_wndMyListCtrl.SetColumn( 1, &Column );
return 0;
}
示例12: ConnectionInfoUpdater
void ConnectionInfoUpdater(void * target)
{
CEdit * connDisplay = (CEdit*)target;
for (;;)
{
if (webserverSimName() != NULL)
{
connDisplay->SetWindowText(webserverSimName()->c_str());
}
else
{
CString simNameString;
simNameString.LoadStringW(IDS_NOT_CONNECTED);
connDisplay->SetWindowText(simNameString);
}
Sleep(1000);
}
}
示例13: OnInitDialog
BOOL CServerBasicGUIDlg::OnInitDialog()
{
CDialogEx::OnInitDialog();
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
// TODO: Add extra initialization here
_beginthread(ConnectionInfoUpdater, 0, &simName);
CString simNameString;
simNameString.LoadStringW(IDS_NOT_CONNECTED);
simName.SetWindowText(simNameString);
CString portNumberString("8080");
portNumber.SetWindowText(portNumberString);
return TRUE; // return TRUE unless you set the focus to a control
}
示例14: OnBnClickedRunServer
void CServerBasicGUIDlg::OnBnClickedRunServer()
{
if (runServer.GetCheck())
{
portNumber.SetReadOnly(true);
launchServer(std::string(address), std::string(""));
}
else
{
stopServer();
portNumber.SetReadOnly(false);
CString simNameString;
simNameString.LoadStringW(IDS_NOT_CONNECTED);
simName.SetWindowText(simNameString);
}
if (webserverSimName() != NULL)
{
simName.SetWindowText(webserverSimName()->c_str());
}
}
示例15: _Process
//.........这里部分代码省略.........
{
errors++;
STLOG_WRITE("CUpdateDlg::_Process(): %s", e.errorMessage());
STLOG_WRITE(sApagaTabela);
STLOG_WRITE("----------------------------------------------------------");
continue;
}
m_manageDB->CreateOneTable(nomeTabela);
BOOL failed = FALSE;
int count;
for(count=0; !fileAtualiza->IsEOF(); count++)
{
if ((count%2000) == 0)
{
Sleep(2000);
}
fileAtualiza->GetRecord(&meu_registro);
insertCommand = fileAtualiza->sqlInsertCommand;
try
{
CppSQLite3DB::getInstance()->execQuery( CStr(insertCommand) );
m_list.SetProgress(i, (int)(100*(count+1)/fileAtualiza->GetTotalRegs()));
}
catch(CppSQLite3Exception e)
{
STLOG_WRITE(L"CUpdateDlg::_Process(1): %S", e.errorMessage());
STLOG_WRITE(insertCommand);
STLOG_WRITE("----------------------------------------------------------");
errors++;
failed = TRUE;
CTableBase::RollbackTransaction(CppSQLite3DB::getInstance());
m_list.SetProgress(i, 0);
break;
}
fileAtualiza->MoveNext();
}
if(count == 0 || errors == 0)
m_list.SetProgress(i, 100);
m_listaArquivos.Lookup(nomeTabela, dadoArquivo);
//TODO: If migracao não atualiza
if(!failed)
{
CStr sQuery;
sQuery.Format("INSERT INTO atualizacao VALUES ('%S', '%S', '%S')",
dadoArquivo->nome.Trim(),
dadoArquivo->data,
dadoArquivo->hora );
try
{
CppSQLite3DB::getInstance()->execQuery( sQuery );
CTableBase::CommitTransaction(CppSQLite3DB::getInstance());
}
catch(CppSQLite3Exception e)
{
errors++;
m_list.SetProgress(i, 0);
CTableBase::RollbackTransaction(CppSQLite3DB::getInstance());
STLOG_WRITE(L"CUpdateDlg::_Process(2): %S", e.errorMessage());
STLOG_WRITE(insertCommand);
STLOG_WRITE("----------------------------------------------------------");
}
}
delete(fileAtualiza);
}
if(errors > 0)
{
errors = 0;
SetCursor(hCurs);
CString sErr;
sErr.LoadStringW(IDS_ERRO_ATUALIZACAO);
MessageBox(sErr, L"Mensagem", MB_ICONINFORMATION|MB_OK);
// Aplicacao nao continua...
return;
}
m_wnd->Show(L"Processando atualizações...");
SetCursor(hCurs);
m_wnd->Hide();
SetStatus(L"Atualização encerrada com sucesso");
Sleep(1000);
return;
}