这篇教程C++ A2T函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中A2T函数的典型用法代码示例。如果您正苦于以下问题:C++ A2T函数的具体用法?C++ A2T怎么用?C++ A2T使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了A2T函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: A2Tvoid CScanMgrDlg::InitExamData(){ USES_CONVERSION; m_comboSubject.ResetContent(); if (_pCurrExam_) { m_strExamName = A2T(_pCurrExam_->strExamName.c_str()); if (_pCurrSub_) { int i = 0; int nShowSubject = -1; for (auto pSubject : _pCurrExam_->lSubjects) { m_comboSubject.AddString(A2T(pSubject->strSubjName.c_str())); int nCount = m_comboSubject.GetCount(); m_comboSubject.SetItemDataPtr(nCount - 1, pSubject); if (_pCurrSub_ == pSubject) nShowSubject = i; i++; } m_comboSubject.SetCurSel(nShowSubject); } } UpdateChildDlgInfo(); UpdateData(FALSE);}
开发者ID:jf4210,项目名称:src2-test,代码行数:29,
示例2: sprintf_sLRESULT CLogoMarkerPropertyPage::OnVScroll(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled){ USES_CONVERSION; HWND hThisSB = (HWND)lParam; if (LOWORD(wParam) == SB_ENDSCROLL) return 0; //reject spurious messages //get position int nPos = (int)::SendMessage(hThisSB, UDM_GETPOS, 0, 0L); char sText[10]; if (hThisSB == m_hSpnSize) { sprintf_s( sText, sizeof(sText), "%.2f/0", (double)nPos); ::SetWindowText(m_hEdtSize, A2T(sText)); } else if (hThisSB == m_hSpnXOffset) { sprintf_s( sText, sizeof(sText), "%+.2f/0", (double)nPos); ::SetWindowText(m_hEdtXOffset, A2T(sText)); } else if (hThisSB == m_hSpnYOffset) { sprintf_s( sText, sizeof(sText), "%+.2f/0", (double)nPos); ::SetWindowText(m_hEdtYOffset, A2T(sText)); }/* else if (hThisSB == m_hSpnAngle) { sprintf( sText, "%.2f/0", (double)nPos / 100); ::SetWindowText(m_hEdtSize, sText); }*/ return 0;}
开发者ID:Aleksei-Iagur,项目名称:arcobjects-sdk-community-samples,代码行数:34,
示例3: A2Tvoid CPositionInquryResultMsg::ParseJSon(const char* json){ USES_CONVERSION; Json::Reader reader; Json::Value root; if (reader.parse(json, root)) { Error = root["errcode"].asInt(); ErrMsg = A2T(root["errmsg"].asString().c_str()); Json::Value data = root["data"]; BP = data["bp"].asDouble(); InitBp = data["init_bp"].asDouble(); ColosPl = data["close_pl"].asDouble(); TradeFee = data["trade_fee"].asDouble(); Json::Value hold = data["hold"]; for (UINT i = 0; i < hold.size(); i++) { Json::Value ¤t = hold[i]; CPositionData *SPositionData = new CPositionData; PositionDatas.push_back(SPositionData); SPositionData->StockID = A2T(current["stock_id"].asString().c_str()); SPositionData->Volume = current["volume"].asInt(); SPositionData->Amount = current["amount"].asDouble(); SPositionData->ArgPrice = current["avg_price"].asDouble(); } }}
开发者ID:Randy090807,项目名称:Github,代码行数:32,
示例4: sprintf/*** /brief connects to the channels and initiates read thread.* /param void* /return S_OK for success, S_FALSE for failure*/HRESULT CDIL_CAN_MHS::CAN_StartHardware(void){USES_CONVERSION;HRESULT hResult;char str[100];//VALIDATE_VALUE_RETURN_VAL(sg_bCurrState, STATE_HW_INTERFACE_SELECTED, ERR_IMPROPER_STATE);if (!str_has_char(sg_MhsCanCfg.CanSnrStr)) sprintf(str, "Snr=%s", sg_MhsCanCfg.CanSnrStr);else str[0]='/0';if (!CanDeviceOpen(0, str)) { (void)CanSetOptions("CanTxAckEnable=1"); // **** CAN Bus Start if (CanSetMode(0, OP_CAN_START, CAN_CMD_FIFOS_ERROR_CLEAR) >= 0) hResult = S_OK; else { hResult = S_FALSE; sg_pIlog->vLogAMessage(A2T(__FILE__), __LINE__, _T("could not start the controller in running mode")); } sg_bCurrState = STATE_CONNECTED; }else { //log the error for open port failure sg_pIlog->vLogAMessage(A2T(__FILE__), __LINE__, _T("error opening /"Tiny-CAN/" interface")); hResult = ERR_LOAD_HW_INTERFACE; }return(hResult);}
开发者ID:Conti-Meissner,项目名称:busmaster,代码行数:37,
示例5: InitSearchDatavoid CExamInfoMgrDlg::InitSearchData(){ std::vector<std::string> vecSub; vecSub.push_back("全部"); std::vector<std::string> vecGrade; vecGrade.push_back("全部"); //获取列表中所有科目名称信息、年级信息 int nAllExamItems = 0; for (auto examObj : g_lExamList) { pEXAMINFO pExam = examObj; for (auto subObj : examObj->lSubjects) { pEXAM_SUBJECT pSub = subObj; bool bFind = false; for (auto strSubName : vecSub) { if (pSub->strSubjName == strSubName) { bFind = true; break; } } if (!bFind && pSub->strSubjName != "") vecSub.push_back(pSub->strSubjName); } bool bFindGrade = false; for (auto strGrade : vecGrade) { if (pExam->strGradeName == strGrade) { bFindGrade = true; break; } } if (!bFindGrade && pExam->strGradeName != "") vecGrade.push_back(pExam->strGradeName); nAllExamItems = pExam->lSubjects.size(); } m_nAllExamListItems = nAllExamItems; m_comboSubject.ResetContent(); m_comboGrade.ResetContent(); USES_CONVERSION; for (auto strSubName : vecSub) m_comboSubject.AddString(A2T(strSubName.c_str())); for (auto strGrade : vecGrade) m_comboGrade.AddString(A2T(strGrade.c_str())); m_comboSubject.AdjustDroppedWidth(); m_comboGrade.AdjustDroppedWidth(); m_comboSubject.SetCurSel(0); m_comboGrade.SetCurSel(0);}
开发者ID:jf4210,项目名称:src2-test,代码行数:59,
示例6: testFrameworkint Matrix_T::transposeTest(void){ TestUtil testFramework("Matrix", "Transpose", __FILE__, __LINE__); gpstk::Matrix<double> A1T(2,2),A2T(3,3),A3T(4,4),A4T(4,5); gpstk::Matrix<double> CompareA1T(2,2),CompareA2T(3,3),CompareA3T(4,4),CompareA4T(5,4); A1T = gpstk::transpose(A1); A2T = gpstk::transpose(A2); A3T = gpstk::transpose(A3); A4T = gpstk::transpose(A4); double temp4[4] = {2,-3,5,-7}; double temp5[9] = {1,3,-5,0,1,-1,-2,-2,9}; double temp6[16] = {2,1,0,0,3,0,2,2,1,3,-3,3,5,1,2,1}; double temp7[20] = {8,7,1,-78,5,-9,7,24,18,5,10,20,-2,0,11,-68,1.5,7,47,0}; CompareA1T = temp4; CompareA2T = temp5; CompareA3T = temp6; CompareA4T = temp7; int badCount = 0; //testFramework.assert(AT == CompareAT, testMesg, __LINE__); for(int i = 0; i < A1T.rows(); i++) for(int j = 0; j < A1T.cols(); j++) if (A1T(i,j) != CompareA1T(i,j)) {badCount++;} failDescriptionStream << "Check if gpstk::transpose(A1) returns the right matrix. " << badCount << " of the elements are incorrect."; failDescriptionString = failDescriptionStream.str(); failDescriptionStream.str(""); testFramework.assert(badCount==0, failDescriptionString, __LINE__); badCount = 0; // Reset error counter for(int i = 0; i < A2T.rows(); i++) for(int j = 0; j < A2T.cols(); j++) if (A2T(i,j) != CompareA2T(i,j)) {badCount++;} failDescriptionStream << "Check if gpstk::transpose(A2) returns the right matrix. " << badCount << " of the elements are incorrect."; failDescriptionString = failDescriptionStream.str(); failDescriptionStream.str(""); testFramework.assert(badCount==0, failDescriptionString, __LINE__); badCount = 0; // Reset error counter for(int i = 0; i < A3T.rows(); i++) for(int j = 0; j < A3T.cols(); j++) if (A3T(i,j) != CompareA3T(i,j)) {badCount++;} failDescriptionStream << "Check if gpstk::transpose(A3) returns the right matrix. " << badCount << " of the elements are incorrect."; failDescriptionString = failDescriptionStream.str(); failDescriptionStream.str(""); testFramework.assert(badCount==0, failDescriptionString, __LINE__); badCount = 0; // Reset error counter for(int i = 0; i < A4T.rows(); i++) for(int j = 0; j < A4T.cols(); j++) if (A4T(i,j) != CompareA4T(i,j)) {badCount++;} failDescriptionStream << "Check if gpstk::transpose(A4) returns the right matrix. " << badCount << " of the elements are incorrect."; failDescriptionString = failDescriptionStream.str(); failDescriptionStream.str(""); testFramework.assert(badCount==0, failDescriptionString, __LINE__); badCount = 0; // Reset error counter return testFramework.countFails(); }
开发者ID:PPNav,项目名称:GPSTk,代码行数:58,
示例7: ipMSymbol/////////////////////////////////////////////////////////////////////////////// IPropertyPageSTDMETHODIMP CLogoMarkerPropertyPage::Show(UINT nCmdShow){ USES_CONVERSION; // If we are showing the property page propulate it // from the Marker symbol object. if ((nCmdShow & (SW_SHOW|SW_SHOWDEFAULT))) { //colors IColorPtr ipColor; m_ipLogoMarker->get_ColorTop(&ipColor); ipColor->get_RGB(&m_colTop); ::SendMessage(m_hRchTop, EM_SETBKGNDCOLOR, 0, (LPARAM) m_colTop); m_ipLogoMarker->get_ColorRight(&ipColor); ipColor->get_RGB(&m_colRight); ::SendMessage(m_hRchRight, EM_SETBKGNDCOLOR, 0, (LPARAM) m_colRight); m_ipLogoMarker->get_ColorLeft(&ipColor); ipColor->get_RGB(&m_colLeft); ::SendMessage(m_hRchLeft, EM_SETBKGNDCOLOR, 0, (LPARAM) m_colLeft); m_ipLogoMarker->get_ColorBorder(&ipColor); ipColor->get_RGB(&m_colBorder); ::SendMessage(m_hRchBorder, EM_SETBKGNDCOLOR, 0, (LPARAM) m_colBorder); //angle, size and offsets char sText[10]; double dText; IMarkerSymbolPtr ipMSymbol(m_ipLogoMarker); ipMSymbol->get_Size(&dText); sprintf_s( sText, sizeof(sText), "%.2f/0", dText); ::SendMessage(m_hSpnSize, UDM_SETPOS, 0, MAKELPARAM((int)(dText), 0)); ::SetWindowText(m_hEdtSize, A2T(sText)); ipMSymbol->get_Angle(&dText); sprintf_s( sText, sizeof(sText), "%d/0", (int)dText); ::SendMessage(m_hSpnAngle, UDM_SETPOS, 0, MAKELPARAM((int)(dText), 0)); ::SetWindowText(m_hEdtAngle, A2T(sText)); ipMSymbol->get_XOffset(&dText); sprintf_s( sText, sizeof(sText), "%+.2f/0", dText); ::SendMessage(m_hSpnXOffset, UDM_SETPOS, 0, MAKELPARAM((int)(dText), 0)); ::SetWindowText(m_hEdtXOffset, A2T(sText)); ipMSymbol->get_YOffset(&dText); sprintf_s( sText, sizeof(sText), "%+.2f/0", dText); ::SendMessage(m_hSpnYOffset, UDM_SETPOS, 0, MAKELPARAM((int)(dText), 0)); ::SetWindowText(m_hEdtYOffset, A2T(sText)); m_bShown = true; } // Let the IPropertyPageImpl deal with displaying the page return IPropertyPageImpl<CLogoMarkerPropertyPage>::Show(nCmdShow);}
开发者ID:Aleksei-Iagur,项目名称:arcobjects-sdk-community-samples,代码行数:59,
示例8: PostOnHeadervoid PostOnHeader(CONNID dwConnID, LPCSTR lpszHeaderName, LPCSTR lpszHeaderValue, LPCTSTR lpszName){ USES_CONVERSION; int content_len = (int)(strlen(lpszHeaderName) + strlen(lpszHeaderValue) + 10); LPTSTR lpszContent = new TCHAR[content_len]; wsprintf(lpszContent, _T("%s: %s"), A2T(lpszHeaderName), A2T(lpszHeaderValue)); info_msg* msg = info_msg::Construct(dwConnID, EVT_ON_HEADER, content_len, lpszContent, lpszName); PostInfoMsg(msg);}
开发者ID:MarkYangUp,项目名称:HP-Socket,代码行数:12,
示例9: PostOnRequestLinevoid PostOnRequestLine(CONNID dwConnID, LPCSTR lpszMethod, USHORT usUrlFieldSet, LPCSTR lpszUrl, LPCTSTR lpszName){ USES_CONVERSION; int content_len = (int)(strlen(lpszMethod) + strlen(lpszUrl) + 20); LPTSTR lpszContent = new TCHAR[content_len]; wsprintf(lpszContent, _T("[%s/0x%02X] : %s"), A2T(lpszMethod), usUrlFieldSet, A2T(lpszUrl)); info_msg* msg = info_msg::Construct(dwConnID, EVT_ON_REQUEST_LINE, content_len, lpszContent, lpszName); PostInfoMsg(msg);}
开发者ID:MarkYangUp,项目名称:HP-Socket,代码行数:12,
示例10: _Tbool CZipObj::ZipFile(CString strSrcPath, CString strDstPath, CString strExtName /*= _T(".zip")*/){ USES_CONVERSION; // CString modelName = strSrcPath.Right(strSrcPath.GetLength() - strSrcPath.ReverseFind('//') - 1); CString zipName = strDstPath + strExtName; std::string strUtf8ZipName = CMyCodeConvert::Gb2312ToUtf8(T2A(zipName)); try { Poco::File p(strUtf8ZipName); //T2A(zipName) if (p.exists()) p.remove(true); } catch (Poco::Exception) { } // std::string strModelPath = T2A(strSrcPath); std::string strUtf8ModelPath = CMyCodeConvert::Gb2312ToUtf8(T2A(strSrcPath)); try { Poco::File p2(strUtf8ModelPath); //T2A(zipName) if (!p2.exists()) { std::string strErr = Poco::format("需要压缩的原文件夹(%s)不存在。", T2A(strSrcPath)); RecordLog(strErr); return false; } } catch (Poco::Exception) { } HZIP hz = CreateZip(zipName, _strPwd.c_str()); Poco::DirectoryIterator it(strUtf8ModelPath); //strModelPath Poco::DirectoryIterator end; while (it != end) { Poco::Path p(it->path()); // std::string strZipFileName = p.getFileName(); std::string strPath = CMyCodeConvert::Utf8ToGb2312(p.toString()); std::string strZipFileName = CMyCodeConvert::Utf8ToGb2312(p.getFileName()); CString strZipPath = A2T(strPath.c_str()); CString strName = A2T(strZipFileName.c_str()); // ZipAdd(hz, A2T(strZipFileName.c_str()), A2T(p.toString().c_str())); ZipAdd(hz, strName, strZipPath); it++; } CloseZip(hz); return true;}
开发者ID:jf4210,项目名称:src2-test,代码行数:53,
示例11: mainvoid main(){ USES_CONVERSION; if (__argc != 2) { printf("Usage: CPing HostName | IPAddress/n"); return; }#ifdef CPING_USE_ICMP{ CPing p1; CPingReply pr1; if (p1.Ping1(A2T(__argv[1]), pr1)) { hostent* phostent = gethostbyaddr((char *)&pr1.Address.S_un.S_addr, 4, PF_INET); printf("%d.%d.%d.%d [%s], replied in RTT:%dms/n", pr1.Address.S_un.S_un_b.s_b1, pr1.Address.S_un.S_un_b.s_b2, pr1.Address.S_un.S_un_b.s_b3, pr1.Address.S_un.S_un_b.s_b4, phostent->h_name, pr1.RTT); } else printf("Failed in call to ping, GetLastError returns: %d", GetLastError());}#endif#ifdef CPING_USE_WINSOCK2{ for(int i=0;i<4;i++) { CPing p2; CPingReply pr2; if (p2.Ping2(A2T(__argv[1]), pr2)) { hostent* phostent = gethostbyaddr((char *)&pr2.Address.S_un.S_addr, 4, PF_INET); if(phostent == NULL) printf("%d.%d.%d.%d, replied in RTT:%dms/n", pr2.Address.S_un.S_un_b.s_b1, pr2.Address.S_un.S_un_b.s_b2, pr2.Address.S_un.S_un_b.s_b3, pr2.Address.S_un.S_un_b.s_b4, pr2.RTT); else printf("%d.%d.%d.%d [%s], replied in RTT:%dms/n", pr2.Address.S_un.S_un_b.s_b1, pr2.Address.S_un.S_un_b.s_b2, pr2.Address.S_un.S_un_b.s_b3, pr2.Address.S_un.S_un_b.s_b4, phostent->h_name, pr2.RTT); } else printf("Failed in call to ping, GetLastError returns: %d", GetLastError()); } } #endif}
开发者ID:haowaiwai,项目名称:test,代码行数:50,
示例12: A2Tvoid CIPFindDlg::GetCurSelIPMask(char *ip, char *mask){ USES_CONVERSION; CString strMsg = MSG_CUR_ADAPTER; strMsg += "IP:"; strMsg += A2T(ip); strMsg += " Mask:"; strMsg += A2T(mask); SetDlgItemText(IDC_STATIC_ADAPTER_MSG, strMsg); m_strFindIP = ip; m_strFindMask = mask;}
开发者ID:matrix207,项目名称:VC,代码行数:15,
示例13: CheckDlgButtonvoid CPPgProxy::LoadSettings(){ USES_CONVERSION; CheckDlgButton(IDC_ASCWOP,(thePrefs.IsProxyASCWOP() )); ((CButton*)GetDlgItem(IDC_ENABLEPROXY))->SetCheck(proxy.UseProxy); ((CButton*)GetDlgItem(IDC_ENABLEAUTH))->SetCheck(proxy.EnablePassword); ((CComboBox*)GetDlgItem(IDC_PROXYTYPE))->SetCurSel(proxy.type); GetDlgItem(IDC_PROXYNAME)->SetWindowText(proxy.name); CString buffer; buffer.Format(_T("%ld"),proxy.port); GetDlgItem(IDC_PROXYPORT)->SetWindowText(buffer); GetDlgItem(IDC_USERNAME_A)->SetWindowText(A2T(proxy.user)); GetDlgItem(IDC_PASSWORD)->SetWindowText(A2T(proxy.password)); OnBnClickedEnableproxy();}
开发者ID:BackupTheBerlios,项目名称:nextemf,代码行数:15,
示例14: sprintf_svoid CLostCornerDlg::InitData(){ if (!m_pPapers) return; m_lcLostCornerPaper.DeleteAllItems(); m_lcLostCornerPaper.DeleteAllItems(); USES_CONVERSION; for (auto pPaper : m_pPapers->lPaper) { bool bInsert = false; for (auto pPic : pPaper->lPic) { if (pPic->lLostCorner.size()) { if (!bInsert) { bInsert = true; //添加进试卷列表控件 int nCount = m_lcLostCornerPaper.GetItemCount(); char szCount[10] = { 0 }; sprintf_s(szCount, "%d", pPaper->nIndex); //nCount + 1 m_lcLostCornerPaper.InsertItem(nCount, NULL); m_lcLostCornerPaper.SetItemText(nCount, 0, (LPCTSTR)A2T(szCount)); m_lcLostCornerPaper.SetItemText(nCount, 1, (LPCTSTR)A2T(pPaper->strSN.c_str())); //显示备注信息,为何出现在此列表 std::string strDetailInfo; strDetailInfo = Poco::format("折角%d个", (int)pPic->lLostCorner.size()); m_lcLostCornerPaper.SetItemText(nCount, 2, (LPCTSTR)A2T(strDetailInfo.c_str())); m_lcLostCornerPaper.SetItemData(nCount, (DWORD_PTR)pPaper); CString strTips = _T("双击显示此试卷信息"); m_lcLostCornerPaper.SetItemToolTipText(nCount, 0, (LPCTSTR)strTips); m_lcLostCornerPaper.SetItemToolTipText(nCount, 1, (LPCTSTR)strTips); m_lcLostCornerPaper.SetItemToolTipText(nCount, 2, (LPCTSTR)strTips); } } } } if (m_lcLostCornerPaper.GetItemCount() > 0) { m_nCurrentPaperID = 0; m_lcLostCornerPaper.GetItemColors(m_nCurrentPaperID, 0, crPaperOldText, crPaperOldBackground); pST_PaperInfo pPaper = (pST_PaperInfo)m_lcLostCornerPaper.GetItemData(m_nCurrentPaperID); ShowPaperDetail(pPaper); }}
开发者ID:jf4210,项目名称:src2-test,代码行数:48,
示例15: _ASSERTEBOOL CSqlite3Recordset::GetField(short iIndex, LPTSTR pData, UINT cchMax){ _ASSERTE(IsOpen()); _ASSERTE(iIndex>=0 && iIndex<m_nCols); if( IsEOF() ) return FALSE; if( iIndex < 0 || iIndex >= m_nCols ) return FALSE; if( m_lType == DB_OPEN_TYPE_FORWARD_ONLY ) {#if !defined(UNICODE) USES_CONVERSION; _tcsncpy(pData, A2T( (char*)::sqlite3_column_text(m_pVm, iIndex) ), cchMax);#else // UNICODE _tcsncpy(pData, (WCHAR*) ::sqlite3_column_text16(m_pVm, iIndex), cchMax);#endif // UNICODE } else { LPSTR pstr = m_ppSnapshot[ ((m_iPos + 1) * m_nCols) + iIndex ]; if( pstr == NULL ) { _tcscpy(pData, _T("")); } else { USES_CONVERSION; LPCSTR pstr = m_ppSnapshot[ ((m_iPos + 1) * m_nCols) + iIndex ]; _tcsncpy(pData, A2CT(pstr), cchMax); } } return TRUE;}
开发者ID:okigan,项目名称:dblib,代码行数:27,
示例16: _accessint _access(const char *sName, int mode){ USES_CONVERSION; WIN32_FIND_DATA FindFileData; PString test(sName); if (test[test.GetLength() - 1] == '.' && test[test.GetLength() - 2] == PDIR_SEPARATOR) test.Delete(test.GetLength() - 2, 2); HANDLE file = FindFirstFile(A2T((const char*) test), &FindFileData); if (file == INVALID_HANDLE_VALUE ) return -1; FindClose(file); switch(mode) { //checking for the existance case 0: return 0; //checking for read permission case 4: return 0; //checking for write permission case 2: return (FindFileData.dwFileAttributes&FILE_ATTRIBUTE_READONLY) ? -1 : 0; //checking for read and write permission case 6: return (FindFileData.dwFileAttributes&FILE_ATTRIBUTE_READONLY) ? -1 : 0; } return -1;}
开发者ID:gawadepd,项目名称:kh323phone,代码行数:25,
示例17: wince_mess_vprintfstatic int wince_mess_vprintf(char *fmt, va_list arg){ int length; int old_length; LPTSTR new_messages; LPCTSTR tbuffer; char buffer[256]; /* get into a buffer */ length = vsnprintf(buffer, sizeof(buffer) / sizeof(buffer[0]), fmt, arg); tbuffer = A2T(buffer); /* output to debugger */ OutputDebugString(tbuffer); /* append the buffer to the rest of the messages */ old_length = messages ? tcslen(messages) : 0; new_messages = realloc(messages, (old_length + tcslen(tbuffer) + 1) * sizeof(TCHAR)); if (new_messages) { messages = new_messages; tcscpy(messages + old_length, tbuffer); } return length;}
开发者ID:broftkd,项目名称:mess-cvs,代码行数:25,
示例18: CoCreateGuidint CUtility::GenerateGUID(CString& sGUID){ int status = 1; sGUID.Empty(); USES_CONVERSION; // Create GUID UCHAR *pszUuid = 0; GUID *pguid = NULL; pguid = new GUID; if(pguid!=NULL) { HRESULT hr = CoCreateGuid(pguid); if(SUCCEEDED(hr)) { // Convert the GUID to a string hr = UuidToStringA(pguid, &pszUuid); if(SUCCEEDED(hr) && pszUuid!=NULL) { status = 0; sGUID = A2T((char*)pszUuid); RpcStringFreeA(&pszUuid); } } delete pguid; } return status;}
开发者ID:doo,项目名称:CrashRpt,代码行数:31,
示例19: win_association_existsBOOL win_association_exists(const struct win_association_info *assoc){ BOOL rc = FALSE; TCHAR buf[1024]; TCHAR expected[1024]; HKEY key1 = NULL; HKEY key2 = NULL; // first check to see if the extension is there at all if (RegOpenKey(HKEY_CLASSES_ROOT, A2T(assoc->file_class), &key1)) goto done; if (RegOpenKey(key1, TEXT("shell//open//command"), &key2)) goto done; if (reg_query_string(key2, buf, sizeof(buf) / sizeof(buf[0]))) goto done; get_open_command(assoc, expected, sizeof(expected) / sizeof(expected[0])); rc = !_tcscmp(expected, buf);done: if (key2) RegCloseKey(key2); if (key1) RegCloseKey(key1); return rc;}
开发者ID:Synapseware,项目名称:coco,代码行数:28,
示例20: ClientToTextBOOL CCrystalEditView::DoDropText(COleDataObject *pDataObject, const CPoint &ptClient){ HGLOBAL hData = pDataObject->GetGlobalData(CF_TEXT); if (hData == NULL) return FALSE; CPoint ptDropPos = ClientToText(ptClient); if (IsDraggingText() && IsInsideSelection(ptDropPos)) { SetAnchor(ptDropPos); SetSelection(ptDropPos, ptDropPos); SetCursorPos(ptDropPos); EnsureVisible(ptDropPos); return FALSE; } LPSTR pszText = (LPSTR) ::GlobalLock(hData); if (pszText == NULL) return FALSE; int x, y; USES_CONVERSION; m_pTextBuffer->InsertText(this, ptDropPos.y, ptDropPos.x, A2T(pszText), y, x, CE_ACTION_DRAGDROP); // [JRT] CPoint ptCurPos(x, y); ASSERT_VALIDTEXTPOS(ptCurPos); SetAnchor(ptDropPos); SetSelection(ptDropPos, ptCurPos); SetCursorPos(ptCurPos); EnsureVisible(ptCurPos); ::GlobalUnlock(hData); return TRUE;}
开发者ID:open2cerp,项目名称:Open2C-ERP,代码行数:33,
示例21: A2Tvoid CNewMessageBox::setShowInfo(int nType, int nBtns, std::string strMsg){ USES_CONVERSION; m_nShowType = nType; m_strMsgShow = A2T(strMsg.c_str()); m_nBtn = nBtns; //++判断将显示的行数// int nLines = 1;// int nSingleCount = 0;// LOGFONT logfont;// if (m_fontStatus.GetSafeHandle())// {// CRect client_rect;// if (GetDlgItem(IDC_STATIC_ShowMsg)->GetSafeHwnd())// GetDlgItem(IDC_STATIC_ShowMsg)->GetClientRect(&client_rect);// m_fontStatus.GetLogFont(&logfont);// int nCharW = logfont.lfWidth;// nSingleCount = client_rect.Width() / nCharW - 1;// int nLen = m_strMsgShow.GetLength() * sizeof(TCHAR);// nLines = nLen / nSingleCount + 1;// } //-- InitUI();}
开发者ID:jf4210,项目名称:src2-test,代码行数:26,
示例22: switch/******************************************************************************* Procedure: CDSPhone::UnsolicitedEvent**** Arguments: 'lpBuff' - Data buffer (structure) specific to code**** Returns: void**** Description: This function processes any responses from the device which** are not matched to a pending line request.*******************************************************************************/bool CDSPhone::UnsolicitedEvent(LPCVOID lpBuff){ USES_CONVERSION; EVENTBUFF* pevBuff = (EVENTBUFF*) lpBuff; switch (pevBuff->dwResponse) { // A lamp has changed states. case EMRESULT_LAMPCHANGED: { LPEMLAMPCHANGE lpChange = (LPEMLAMPCHANGE) pevBuff->lpBuff; SetLampState ((int)lpChange->wButtonLampID, g_LampStates[lpChange->wLampState]); } break; // A hookswitch device has changed states. case EMRESULT_HSCHANGED: { LPEMHOOKSWITCHCHANGE lpChange = (LPEMHOOKSWITCHCHANGE) pevBuff->lpBuff; _TSP_ASSERTE (lpChange->wHookswitchID == HSDEVICE_HANDSET); SetHookSwitch (PHONEHOOKSWITCHDEV_HANDSET, g_hsStates[lpChange->wHookswitchState]); } break; // A button has changed case EMRESULT_BUTTONCHANGED: { LPEMBUTTONCHANGE lpChange = (LPEMBUTTONCHANGE) pevBuff->lpBuff; SetButtonState (lpChange->wButtonLampID, g_ButtonStates[lpChange->wButtonState]); } break; // Ringer mode changed case EMRESULT_RINGCHANGE: SetRingMode (*((LPDWORD)pevBuff->lpBuff)); break; // Volume/Gain of the handset changed case EMRESULT_LEVELCHANGED: { LPEMLEVELCHANGE lpChange = (LPEMLEVELCHANGE) pevBuff->lpBuff; if (lpChange->wLevelType == LEVELTYPE_MIC) SetGain (PHONEHOOKSWITCHDEV_HANDSET, lpChange->wLevel); else if (lpChange->wLevelType == LEVELTYPE_SPEAKER) SetVolume (PHONEHOOKSWITCHDEV_HANDSET, lpChange->wLevel); } break; // The display has changed. case EMRESULT_DISPLAYCHANGED: { LPEMDISPLAY lpChange = (LPEMDISPLAY) pevBuff->lpBuff; SetDisplay (A2T(lpChange->szDisplay)); } break; } return true;}// CDSPhone::UnsolicitedEvent
开发者ID:junction,项目名称:jn-tapi,代码行数:71,
示例23: vRetrieveAndLog/*** /brief Function to retreive error occurred and log it* /param[in] File, pointer to log file* /param[in] Line, indicates line number in log file* /return void* /authors Arunkumar Karri* /date 07.10.2011 Created*/static void vRetrieveAndLog(DWORD /*dwErrorCode*/, char* File, int Line){ USES_CONVERSION; char acErrText[MAX_PATH] = {'/0'}; /* Get the error text for the corresponding error code */ sg_pIlog->vLogAMessage(A2T(File), Line, A2T(acErrText)); size_t nStrLen = strlen(acErrText); if (nStrLen > CAN_MAX_ERRSTR) { nStrLen = CAN_MAX_ERRSTR; } sg_acErrStr = acErrText;}
开发者ID:ETAS-Nithin,项目名称:busmaster,代码行数:24,
示例24: _Tvoid CScanMgrDlg::DownLoadModel(){ if (!_pCurrExam_ || !_pCurrSub_) return; g_nDownLoadModelStatus = 0; //先查本地列表,如果没有则请求,如果有,计算crc,和服务器不同则下载 USES_CONVERSION; CString modelPath = g_strCurrentPath + _T("Model"); modelPath = modelPath + _T("//") + A2T(_pCurrSub_->strModelName.c_str()); std::string strModelPath = T2A(modelPath); ST_DOWN_MODEL stModelInfo; ZeroMemory(&stModelInfo, sizeof(ST_DOWN_MODEL)); stModelInfo.nExamID = _pCurrExam_->nExamID; stModelInfo.nSubjectID = _pCurrSub_->nSubjID; sprintf_s(stModelInfo.szUserNo, "%s", _strUserName_.c_str()); sprintf_s(stModelInfo.szModelName, "%s", _pCurrSub_->strModelName.c_str()); Poco::File fileModel(CMyCodeConvert::Gb2312ToUtf8(strModelPath)); if (fileModel.exists()) { std::string strMd5 = calcFileMd5(strModelPath); strncpy(stModelInfo.szMD5, strMd5.c_str(), strMd5.length()); } std::string strLog = "请求下载模板: "; strLog.append(stModelInfo.szModelName); g_pLogger->information(strLog); pTCP_TASK pTcpTask = new TCP_TASK; pTcpTask->usCmd = USER_NEED_DOWN_MODEL; pTcpTask->nPkgLen = sizeof(ST_DOWN_MODEL); memcpy(pTcpTask->szSendBuf, (char*)&stModelInfo, sizeof(ST_DOWN_MODEL)); g_fmTcpTaskLock.lock(); g_lTcpTask.push_back(pTcpTask); g_fmTcpTaskLock.unlock(); g_eDownLoadModel.wait(); if (g_nDownLoadModelStatus == 2) { //模板下载完成 strLog.append(" ==>此模板下载成功."); } else if (g_nDownLoadModelStatus == 3) { strLog.append(" ==>此模板本地以及存在且无修改,不需要重新下载."); } else if (g_nDownLoadModelStatus == -1) { strLog.append(" ==>服务器此科目模板不存在."); } else if (g_nDownLoadModelStatus == -2) { strLog.append(" ==>服务器读取文件失败."); } g_pLogger->information(strLog);}
开发者ID:jf4210,项目名称:src2-test,代码行数:59,
示例25: VALIDATE_VALUE_RETURN_VAL/*** @brief Sends STCAN_MSG structure from the client dwClientID.* @param[in] dwClientID is the client ID* @param[in] sMessage is the application specific CAN message structure* @return S_OK for success, S_FALSE for failure*/HRESULT CDIL_CAN_VSCOM::sendMessage(DWORD dwClientID, const STCAN_MSG& sMessage){ VSCAN_MSG msg; DWORD dwTemp; static SACK_MAP sAckMap; HRESULT hResult; VALIDATE_VALUE_RETURN_VAL(sg_bCurrState, STATE_CONNECTED, ERR_IMPROPER_STATE); hResult = S_FALSE; if (bClientIdExist(dwClientID)) { if (sMessage.m_ucChannel <= sg_nNoOfChannels) { memset(&msg, 0, sizeof(msg)); if (sMessage.m_ucEXTENDED == 1) { msg.Flags |= VSCAN_FLAGS_EXTENDED; } if (sMessage.m_ucRTR == 1) { msg.Flags |= VSCAN_FLAGS_REMOTE; } msg.Id = sMessage.m_unMsgID; msg.Size = sMessage.m_ucDataLen; memcpy(msg.Data, &sMessage.m_ucData, msg.Size); sAckMap.m_ClientID = dwClientID; sAckMap.m_Channel = sMessage.m_ucChannel; sAckMap.m_MsgID = msg.Id; vMarkEntryIntoMap(sAckMap); if (VSCAN_Write(sg_VSCanCfg.hCan, &msg, 1, &dwTemp) == VSCAN_ERR_OK && dwTemp == 1) { static STCANDATA can_data; CopyMsg2CanData(&can_data, &msg, TX_FLAG); EnterCriticalSection(&sg_DIL_CriticalSection); //Write the msg into registered client's buffer vWriteIntoClientsBuffer(can_data); LeaveCriticalSection(&sg_DIL_CriticalSection); hResult = S_OK; } else { hResult = S_FALSE; sg_pIlog->logMessage(A2T(__FILE__), __LINE__, _("could not write can data into bus")); } } else { hResult = ERR_INVALID_CHANNEL; } } else { hResult = ERR_NO_CLIENT_EXIST; } return(hResult);}
开发者ID:Huigang610,项目名称:busmaster-1,代码行数:64,
示例26: DisplayAboutvoid ABOUT_API DisplayAbout(CWnd* i_pParent){ USES_CONVERSION; CString string; CString templ = MLL::LoadString(IDS_SOFTWARE_INFO); string.Format(templ, A2T(__DATE__)); //compiler uses only ASCII format... AboutStc(i_pParent, hInstance, (LPCTSTR)IDB_BITMAP0001, (LPCTSTR)IDR_RGN0001, string, MLL::LoadString(IDS_AUTHOR_INFO));}
开发者ID:fredcooke,项目名称:secu3man,代码行数:9,
示例27: DisplaySplash//timeToshow - How long show splash screen, in milliseconds.void ABOUT_API DisplaySplash(int timeToShow){ USES_CONVERSION; CString string; CString templ = MLL::LoadString(IDS_SOFTWARE_INFO); string.Format(templ, A2T(__DATE__)); //compiler uses only ASCII format... AboutStc(CWnd::GetDesktopWindow(), hInstance, (LPCTSTR)IDB_BITMAP0001, (LPCTSTR)IDR_RGN0001, string, MLL::LoadString(IDS_AUTHOR_INFO), true, timeToShow);}
开发者ID:fredcooke,项目名称:secu3man,代码行数:10,
示例28: strcpyBOOL CConverter::Open(LPCTSTR pszFileName, UINT nOpenFlags, CFileException* pException){ USES_CONVERSION; // we convert to oem and back because of the following case // test(c).txt becomes testc.txt in OEM and stays testc.txt to Ansi char buf[_MAX_PATH]; strcpy(buf, T2CA(pszFileName)); CharToOemA(buf, buf); OemToCharA(buf, buf); LPTSTR lpszFileNameT = A2T(buf); // let's make sure we could do what is wanted directly even though we aren't m_bCloseOnDelete = FALSE;#if _MSC_VER >= 1400 m_hFile = hFileNull;#else m_hFile = (UINT)hFileNull;#endif BOOL bOpen = CFile::Open(lpszFileNameT, nOpenFlags, pException); CFile::Close(); if (!bOpen) return FALSE; m_bForeignToRtf = !(nOpenFlags & (CFile::modeReadWrite | CFile::modeWrite)); // check for reading empty file if (m_bForeignToRtf) { CFileStatus stat; if (CFile::GetStatus(lpszFileNameT, stat) && stat.m_size == 0) return TRUE; } //set security attributes to inherit handle SECURITY_ATTRIBUTES sa = {sizeof(SECURITY_ATTRIBUTES), NULL, TRUE}; //create the events m_hEventFile = CreateEvent(&sa, TRUE, FALSE, NULL); m_hEventConv = CreateEvent(&sa, TRUE, FALSE, NULL); //create the converter thread and create the events CharToOemA(buf, buf); ASSERT(m_hFileName == NULL); m_hFileName = StringToHGLOBAL(buf); m_pThis = this; m_bDone = FALSE; m_hBuff = GlobalAlloc(GHND, BUFFSIZE); ASSERT(m_hBuff != NULL); AfxBeginThread(ConverterThread, this, THREAD_PRIORITY_NORMAL, 0, 0, &sa); return TRUE;}
开发者ID:BraveStone,项目名称:wordpad,代码行数:56,
示例29: SAFE_RELEASEvoid CScanMgrDlg::InitScanner(){ if (_pTWAINApp) { _pTWAINApp->exit(); SAFE_RELEASE(_pTWAINApp); } _pTWAINApp = new TwainApp(m_hWnd); TW_IDENTITY *pAppID = _pTWAINApp->getAppIdentity(); pAppID->Version.MajorNum = 2; pAppID->Version.MinorNum = 1; pAppID->Version.Language = TWLG_ENGLISH_CANADIAN; pAppID->Version.Country = TWCY_CANADA; SSTRCPY(pAppID->Version.Info, sizeof(pAppID->Version.Info), "2.1.1"); pAppID->ProtocolMajor = TWON_PROTOCOLMAJOR; pAppID->ProtocolMinor = TWON_PROTOCOLMINOR; pAppID->SupportedGroups = DF_APP2 | DG_IMAGE | DG_CONTROL; SSTRCPY(pAppID->Manufacturer, sizeof(pAppID->Manufacturer), "TWAIN Working Group"); SSTRCPY(pAppID->ProductFamily, sizeof(pAppID->ProductFamily), "Sample"); SSTRCPY(pAppID->ProductName, sizeof(pAppID->ProductName), "MFC Supported Caps"); _pTWAINApp->connectDSM(); if (_pTWAINApp->m_DSMState >= 3) { pTW_IDENTITY pID = NULL; int i = 0; int index = 0; int nDefault = -1; // Emply the list the refill m_vecScanSrc.clear(); if (NULL != (pID = _pTWAINApp->getDefaultDataSource())) // Get Default { nDefault = pID->Id; } USES_CONVERSION; while (NULL != (pID = _pTWAINApp->getDataSource((TW_INT16)i))) { m_vecScanSrc.push_back(A2T(pID->ProductName)); if (LB_ERR == index) { break; } i++; } _pTWAINApp->disconnectDSM(); } else { std::string strLog = "获取扫描仪列表 --> 连接扫描源失败"; g_pLogger->information(strLog); }}
开发者ID:jf4210,项目名称:src2-test,代码行数:56,
注:本文中的A2T函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ A2W函数代码示例 C++ A22函数代码示例 |