本文整理汇总了C++中CA2W函数的典型用法代码示例。如果您正苦于以下问题:C++ CA2W函数的具体用法?C++ CA2W怎么用?C++ CA2W使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CA2W函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetBody
void CCommandProcessor::OnPingClientResp(BYTE *pBuffer, size_t bufLen)
{
PINGCLIENTRESP pcr = {0};
GetBody(pBuffer, &pcr, sizeof PINGCLIENTRESP);
CString strTermID = CA2W(pcr.termId);
CString strIP = CA2W(pcr.termIp);
INT_PTR nIndex = m_lpLocalServer->ComputerList.Find(strTermID, strIP);
if (nIndex >= 0)
{
CComputerInfo& computer = m_lpLocalServer->ComputerList.GetComputer(nIndex);
if (computer.GetComputerStatus() == CComputerInfo::ECS_THIEF)
{
if (0 == pcr.cCode) //不通
{
computer.SetComputerStatus(CComputerInfo::ECS_OFFLINE);
}
}
else if (computer.GetComputerStatus() == CComputerInfo::ECS_OFFLINE)
{
if (1 == pcr.cCode) //通
{
computer.SetComputerStatus(CComputerInfo::ECS_THIEF);
}
}
m_lpLocalServer->ComputerList.UpdateComputer(nIndex, computer);
m_lpLocalServer->GetComputerListView()->Refresh(FALSE);
}
}
示例2: EncConverterConvertStringA
ECDRIVER_API HRESULT EncConverterConvertStringA(LPCSTR lpszConverterName, LPCSTR lpszInput, LPSTR lpszOutput, int nOutputLen)
{
CStringW strConverterName = CA2W(lpszConverterName, 65001);
CSilEncConverter* pEC = GetEncConverter(strConverterName);
if (!(*pEC))
pEC->Initialize(pEC->ConverterName, pEC->DirectionForward, pEC->NormalizeOutput);
if (!(*pEC))
return /*NameNotFound*/ -7;
int nCodePage = (pEC->IsInputLegacy()) ? pEC->CodePageInput() : /* UTF8 */ 65001;
// EncConverter's interface is easiest when wide
CStringW strInput = CA2W(lpszInput, nCodePage);
CStringW strOutputW;
HRESULT hr = pEC->Convert(strInput, strOutputW);
if (hr < 0)
return hr;
nCodePage = (pEC->IsOutputLegacy()) ? pEC->CodePageOutput() : /* UTF8 */ 65001;
CStringA strOutput = CW2A(strOutputW, nCodePage);
strncpy(lpszOutput, (LPCSTR)strOutput, nOutputLen);
return S_OK;
}
示例3: GetWindowRect
/**
* FUNCTION OnInitDialog
*
* @brief
*
* @version 1.0
*
* @author David Libby
* @date 8/2/2013 11:38:34 AM
*
* @param uMsg
* @param wParam
* @param lParam
* @param bHandled
*
* @return LRESULT
*/
LRESULT LaserStatusDialog::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
//SetWindowPos(HWND_TOPMOST,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE);
GetWindowRect(&m_LargeRect);
m_SmallRect=m_LargeRect;
m_SmallRect.right-=SHRINK_SIZE;
SetWindowSmall();
GetDlgItem(IDC_STATIC_TEMP).GetClientRect(&m_StaticTempRectangle);
GetDlgItem(IDC_STATIC_TEMP).MapWindowPoints(this->m_hWnd,(LPPOINT)&m_StaticTempRectangle,2);
GetDlgItem(IDC_STATIC_LASER_STATUS).GetClientRect(&m_StaticLaserStatusRectangle);
GetDlgItem(IDC_STATIC_LASER_STATUS).MapWindowPoints(this->m_hWnd,(LPPOINT)&m_StaticLaserStatusRectangle,2);
m_Button_Start_Stop=GetDlgItem(ID_START_STOP);
SetStartStopStatusText();
//Prep out degrees per Pix
int recHeight=m_StaticTempRectangle.bottom-m_StaticTempRectangle.top;
double temprange = TOP_TEMP_C - BOTTOM_TEMP_C;
m_dDegreesCPerPix = (double)recHeight/temprange;
std::string WindowText="Laser Dialog ( 488 nm )";
this->SetWindowTextW(CA2W(WindowText.c_str()).m_szBuffer);
//HFONT MyOldTextFont = GetDlgItem(IDC_STATIC_LASER_NM).GetFont();
//LOGFONT MyNewFontFont;
//GetObject ( MyOldTextFont, sizeof(LOGFONT), &MyNewFontFont );
//MyNewFontFont.lfHeight = 24 ; // request a 12-pixel-height font
//_tcsncpy_s(MyNewFontFont.lfFaceName, LF_FACESIZE, _T("Arial"), 7);
//HFONT hCustomFont = CreateFontIndirect ( &MyNewFontFont );
std::string Power_mW="50";
m_Edit_Power=GetDlgItem(IDC_EDIT_POWER_MW);
m_Edit_Power.SetWindowTextW(CA2W(Power_mW.c_str()).m_szBuffer);
//GetDlgItem(IDC_STATIC_LASER_NM).SetFont(hCustomFont);
if(m_OnTop)
{
SetWindowPos(HWND_TOPMOST,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE);
}else
{
SetWindowPos(HWND_BOTTOM,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE);
}
//::SetForegroundWindow(GetDlgItem(IDD_DIALOG_PROGRESS));
::SetWindowPos(this->m_hWnd,HWND_TOPMOST,0,0,0,0,SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE);
return 1;
};
示例4: UpdateData
void CFoosballDlg::OnTimer(UINT_PTR nIDEvent)
{
char Count[32];
UpdateData(TRUE); // get tthe latest m_PositionSelection value
GetEncoderCount(m_PositionSelection, MOVE_MOTOR, Count);
SetDlgItemText(IDC_STATIC_MOVE_COUNT, CA2W(Count));
GetEncoderCount(m_PositionSelection, KICK_MOTOR, Count);
SetDlgItemText(IDC_STATIC_KICK_COUNT, CA2W(Count));
__super::OnTimer(nIDEvent);
}
示例5: GetObject
void LaserStatusDialog::DrawTempatureScaleText(HDC &hdc,RECT DrawArea,std::string TempString)
{
//DrawArea.top-=19;
HFONT hFont, hOldFont;
// Retrieve a handle to the variable stock font.
hFont = (HFONT)GetStockObject(DEFAULT_GUI_FONT);
LOGFONT LargeFont,SmallFont;
GetObject ( hFont, sizeof(LOGFONT), &LargeFont );
LargeFont.lfHeight = 20 ; // request a 12-pixel-height font
_tcsncpy_s(LargeFont.lfFaceName, LF_FACESIZE, _T("Arial"), 7);
SmallFont=LargeFont;
HFONT hCustomLargeFont = CreateFontIndirect ( &LargeFont );
HFONT hCustomSmallFont = CreateFontIndirect ( &SmallFont );
int gray=110;
COLORREF OldCOlor = SetTextColor(hdc, RGB(gray,gray,gray));
hOldFont = (HFONT)SelectObject(hdc, hCustomLargeFont);
//Build a 1 pix Gray border by drawing the text sihfted in all 4 directions
int oldCkgroundMode = SetBkMode(hdc, TRANSPARENT);
int pixAtound =1;
DrawArea.top-=pixAtound;
DrawText(hdc,CA2W(TempString.c_str()).m_szBuffer,TempString.size(),&DrawArea,DT_CENTER);
DrawArea.top+=pixAtound;
DrawArea.left-=pixAtound;
DrawText(hdc,CA2W(TempString.c_str()).m_szBuffer,TempString.size(),&DrawArea,DT_CENTER);
DrawArea.bottom+=pixAtound;
DrawArea.left+=pixAtound;
DrawText(hdc,CA2W(TempString.c_str()).m_szBuffer,TempString.size(),&DrawArea,DT_CENTER);
DrawArea.bottom-=pixAtound;
DrawArea.right+=pixAtound;
DrawText(hdc,CA2W(TempString.c_str()).m_szBuffer,TempString.size(),&DrawArea,DT_CENTER);
DrawArea.right-=pixAtound;
//Now draw the font black Centered.
SetTextColor(hdc, RGB(0,0,0));
SelectObject(hdc, hCustomSmallFont);
DrawText(hdc,CA2W(TempString.c_str()).m_szBuffer,TempString.size(),&DrawArea,DT_CENTER);
SetBkMode(hdc, oldCkgroundMode );
// Restore the original font.
SelectObject(hdc, hOldFont);
// Restore the original Color.
SetTextColor(hdc, OldCOlor);
}
示例6: SetIcon
BOOL CFoosballDlg::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
VERIFY(m_Exit.AutoLoad(IDEXIT, this));
WINDOWPLACEMENT lpwndpl;
GetWindowPlacement(&lpwndpl);
MainWnd = this;
ImageDC = GetDlgItem(IDC_DISPLAY)->GetDC();
ParentWnd = GetDlgItem(IDC_DISPLAY);
ParentWnd->GetWindowPlacement(&lpwndpl);
ImageRect = lpwndpl.rcNormalPosition;
// initialization must be done in this order. cannot be changed
Init();
m_ColorTool.ColorToolInit(ParentWnd->GetDC(), ImageRect, DigSizeX, DigSizeY);
ReadSysConfiguration();
SetFieldPlayerMask();
ConnectToControllers();
for (int i = 0; i < ROWS_PLAYER; i++) {
GetDlgItem(IDC_FORWARD + i)->EnableWindow(Device[DeviceMap[i]].IsConnected());
}
char Str[8];
m_SliderMove.SetRange(-1000, 1000, TRUE);
m_SliderKick.SetRange(-1000, 1000, TRUE);
m_SliderPlayer.SetRange(0, 255, TRUE);
m_SliderBall.SetRange(0, 255, TRUE);
m_SliderMove.SetPos(0); sprintf_s(Str, "%d", 0); SetDlgItemText(IDC_STATIC_MOVE, CA2W(Str));
m_SliderKick.SetPos(0); sprintf_s(Str, "%d", 0); SetDlgItemText(IDC_STATIC_KICK, CA2W(Str));
m_SliderPlayer.SetPos(SC.PlayerThreshold); sprintf_s(Str, "%d", SC.PlayerThreshold); SetDlgItemText(IDC_STATIC_PLAYER, CA2W(Str));
m_SliderBall.SetPos(SC.BallThreshold); sprintf_s(Str, "%d", SC.BallThreshold); SetDlgItemText(IDC_STATIC_BALL, CA2W(Str));
m_UpdateImage = UpdateImage;
m_UpdateGraphics = UpdateGraphics;
m_DisplaySelection = DisplaySelection;
m_Acquisition = Acquisition;
// only for testing
m_PositionSelection = BACKFIELD_ROW;
m_MoveMotorMode = MotorMode[MOVE_MOTOR][m_PositionSelection];
m_KickMotorMode = MotorMode[KICK_MOTOR][m_PositionSelection];
UpdateData(FALSE);
SetTimer(0, 200, NULL); // Run timer to update encoder count
return TRUE; // return TRUE unless you set the focus to a control
}
示例7: sprintf_s
void CFoosballDlg::OnBnClickedSaveImage()
{
// OnBnClickedStop();
char DirectoryName[128];
char Filter[128];
sprintf_s(Filter, "Bitmap Image (*.bmp)|*.bmp|| | TIFF Document (*.tif)|*.tif");
sprintf_s(DirectoryName, "%sImages\\*.bmp", APP_DIRECTORY);
CFileDialog dlg(FALSE, L"bmp", CA2W(DirectoryName), OFN_PATHMUSTEXIST, CA2W(Filter), NULL);
if (dlg.DoModal() == IDOK) {
char FileName[512];
strcpy_s(FileName, CT2A(dlg.GetPathName()));
imwrite(FileName, DispBuf);
}
}
示例8: EncConverterInitializeConverterA
ECDRIVER_API HRESULT EncConverterInitializeConverterA(LPCSTR lpszConverterName, BOOL bDirectionForward, int eNormOutputForm)
{
CStringW strConverterName = CA2W(lpszConverterName, 65001);
CSilEncConverter* pEC = GetEncConverter(strConverterName);
ATLASSERT(pEC != 0);
return pEC->Initialize(strConverterName, bDirectionForward, eNormOutputForm);
}
示例9: LOAD_CONFIG
bool ImgConfig::parse()
{
Json::Value value;
LOAD_CONFIG(ConfigFile::ImgConfigPath, value);
Json::Value jsonRoot = value["resimg"];
if (jsonRoot == Json::nullValue)
{
return false;
}
csResPath = CA2W(jsonRoot["res_path"].asCString(), CP_UTF8).m_psz;
// CStringA strPath;
// int nImgId = 0;
// int nSize = jsonRoot.size();
//
// for (int nIndex = 0; nIndex < nSize; ++nIndex)
// {
// Json::Value jsonIndexValue = jsonRoot[nIndex];
//
// if (jsonIndexValue == Json::nullValue)
// {
// continue;
// }
//
// nImgId = jsonIndexValue["img_id"].asInt();
// strPath = jsonIndexValue["img_path"].asCString();
// mapResImg[nImgId] = CA2W(strPath, CP_UTF8).m_psz;
// nImgId = 0;
// }
return true;
}
示例10: FetchData
// S_OK : 성공
// S_FALSE : 데이터는 가져왔지만 Consumer가 원하는 데이터가 아님
// E_FAIL : 실패
static HRESULT FetchData(int hReq, CTablesInfoRow &tirData, int table_type)
{
char *value;
int int_value;
int ind, res;
T_CCI_ERROR err_buf;
res = cci_fetch(hReq, &err_buf);
if(res<0) return RaiseError(E_FAIL, 1, __uuidof(IDBSchemaRowset), err_buf.err_msg);
res = cci_get_data(hReq, 1, CCI_A_TYPE_STR, &value, &ind);
if(res<0) return RaiseError(E_FAIL, 0, __uuidof(IDBSchemaRowset));
wcscpy(tirData.m_szTableName, CA2W(value));
res = cci_get_data(hReq, 2, CCI_A_TYPE_INT, &int_value, &ind);
if(res<0) return RaiseError(E_FAIL, 0, __uuidof(IDBSchemaRowset));
if (table_type >= 0 && table_type != int_value)
return S_FALSE;
if (int_value == 2)
wcscpy(tirData.m_szTableType, L"TABLE");
else if (int_value == 1)
wcscpy(tirData.m_szTableType, L"VIEW");
else if (int_value == 0)
wcscpy(tirData.m_szTableType, L"SYSTEM TABLE");
tirData.m_bBookmarks = ATL_VARIANT_TRUE;
tirData.m_bBookmarkType = DBPROPVAL_BMK_NUMERIC;
tirData.m_bBookmarkDatatype = DBTYPE_BYTES;
tirData.m_bBookmarkMaximumLength = sizeof(DBROWCOUNT);
return S_OK;
}
示例11: strMinVer
void CCommandProcessor::OnLogin(BYTE* pBuffer, size_t bufLen)
{
const CString strMinVer(_T("3.1.1.4"));
NET_HEAD_MAN head = {0};
GetHead(pBuffer, &head);
if (head.Length > 0)
{
MANAGER_LOGIN_RESP Login_Resp = {0};
GetBody(pBuffer, &Login_Resp, sizeof Login_Resp);
CString strVer = CA2W(Login_Resp.szServerVer);
if (strVer >= strMinVer)
{
m_lpLocalServer->LocalGetPCClassMap();
m_lpLocalServer->LocalGetComputerList();
return;
}
}
CString strTmp;
strTmp.Format(IDS_ISERVERLOWVER, strMinVer);
AfxMessageBox(strTmp, MB_ICONINFORMATION);
TerminateProcess(GetCurrentProcess(), 0);
}
示例12: LOG
int DocumentHost::AddCookie(const std::string& cookie) {
LOG(TRACE) << "Entering DocumentHost::AddCookie";
CComBSTR cookie_bstr(CA2W(cookie.c_str(), CP_UTF8));
CComPtr<IHTMLDocument2> doc;
this->GetDocument(&doc);
if (!doc) {
LOG(WARN) << "Unable to get document";
return EUNHANDLEDERROR;
}
if (!this->IsHtmlPage(doc)) {
LOG(WARN) << "Unable to add cookie, document does not appear to be an HTML page";
return ENOSUCHDOCUMENT;
}
HRESULT hr = doc->put_cookie(cookie_bstr);
if (FAILED(hr)) {
LOGHR(WARN, hr) << "Unable to put cookie to document, call to IHTMLDocument2::put_cookie failed";
return EUNHANDLEDERROR;
}
return SUCCESS;
}
示例13: ATLASSERT
void CBkInfoDownloadManager::NotifyCoreBankCtrlDLFinish(LPSTR lpBankID)
{
ATLASSERT (NULL != lpBankID);
if (NULL == lpBankID)
return;
std::string strBkID;
strBkID = lpBankID;
CListManager::_()->AddANewFavBank ((LPWSTR)CA2W(strBkID.c_str ()), false);
CListManager::_()->UpdateHMac ();
CFavBankOperator* pOper = CListManager::_()->GetFavBankOper();
ATLASSERT (NULL != pOper);
if (NULL == pOper)
return;
pOper->UpDateFavBankID (strBkID);
CListManager::_()->CheckCom(strBkID);//尝试创建该对象,以确定是否已经将控件正确加入
//int nTp;
//CFavBankOperator::MyTranslateBetweenBankIDAndInt (strBkID, nTp);// 第三参数默认为true,表示将bankID转换成int
// 用于通知主框架,用户添加收藏银行
//SendMessage(g_hMainFrame, WM_FAV_BANK_CHANGE, 0, (LPARAM)nTp); // gao 通知框架用户收藏银行发生变化
}
示例14: LOG
int Alert::SendKeys(std::string keys) {
LOG(TRACE) << "Entering Alert::SendKeys";
HWND text_box_handle = NULL;
// Alert present, find the OK button.
// Retry up to 10 times to find the dialog.
int max_wait = 10;
while ((text_box_handle == NULL) && --max_wait) {
::EnumChildWindows(this->alert_handle_,
&Alert::FindTextBox,
reinterpret_cast<LPARAM>(&text_box_handle));
if (text_box_handle == NULL) {
::Sleep(50);
}
}
if (text_box_handle == NULL) {
LOG(WARN) << "Text box not found on alert";
return EELEMENTNOTDISPLAYED;
} else {
LOG(DEBUG) << "Sending keystrokes to alert using SendMessage";
std::wstring text = CA2W(keys.c_str(), CP_UTF8);
::SendMessage(text_box_handle,
WM_SETTEXT,
NULL,
reinterpret_cast<LPARAM>(text.c_str()));
}
return SUCCESS;
}
示例15: LOG
int Element::GetAttributeValue(const std::string& attribute_name,
std::string* attribute_value,
bool* value_is_null) {
LOG(TRACE) << "Entering Element::GetAttributeValue";
std::wstring wide_attribute_name = CA2W(attribute_name.c_str(), CP_UTF8);
int status_code = SUCCESS;
// The atom is just the definition of an anonymous
// function: "function() {...}"; Wrap it in another function so we can
// invoke it with our arguments without polluting the current namespace.
std::wstring script_source(L"(function() { return (");
script_source += atoms::asString(atoms::GET_ATTRIBUTE);
script_source += L")})();";
CComPtr<IHTMLDocument2> doc;
this->GetContainingDocument(false, &doc);
Script script_wrapper(doc, script_source, 2);
script_wrapper.AddArgument(this->element_);
script_wrapper.AddArgument(wide_attribute_name);
status_code = script_wrapper.Execute();
CComVariant value_variant;
if (status_code == SUCCESS) {
*value_is_null = !script_wrapper.ConvertResultToString(attribute_value);
} else {
LOG(WARN) << "Failed to determine element attribute";
}
return SUCCESS;
}