int KJxUpdaterDlg::ClearFile(const CString &strPath) { int nRetCode = FALSE; CString strPathName; CString strFullPathFile; CString strFile; WIN32_FIND_DATA FindFileData; HANDLE hFindFile = NULL; strPathName = strPath + _T("*.*"); hFindFile = FindFirstFile(strPathName.GetString(), &FindFileData); if (hFindFile != INVALID_HANDLE_VALUE) { while (true) { strFile = FindFileData.cFileName; if ( (strFile != _T(".")) && (strFile != _T("..")) ) { strFullPathFile = strPath + strFile; if (!(FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) { _tremove(strFullPathFile.GetString()); } else { strFullPathFile += _T("\\"); ClearFile(strFullPathFile); } } nRetCode = FindNextFile(hFindFile, &FindFileData); if (!nRetCode) { if (GetLastError() == ERROR_NO_MORE_FILES) break; } } } return TRUE; }
CString Utils::GetAppFullPath(void) { static CString s_appFullPath; if (s_appFullPath.IsEmpty()) { s_appFullPath.ReleaseBufferSetLength(::GetModuleFileName(NULL, s_appFullPath.GetBuffer(MAX_PATH), MAX_PATH)); } return s_appFullPath.GetString(); }
CString ImageRecordingConfiguration::getFullRecordingPathForImageType(ImageRecordType imageType, CString outputFolder, CString timeStampFolderName) { CString subFolder = getSubFolderNameForImageType(imageType); CString fullPath; fullPath += outputFolder.GetString(); auto outputEnding = fullPath.Right(1); if (outputEnding != L"\\"){ fullPath += _T("\\"); } fullPath += timeStampFolderName.GetString(); outputEnding = fullPath.Right(1); if (outputEnding != L"\\"){ fullPath += _T("\\"); } fullPath += subFolder; return fullPath; }
void SetPaneString(int nIndext,CString str) { CMFCStatusBar * pStatusBar=NULL; if(AfxGetMainWnd()->GetActiveWindow()==NULL)//if this function is called by a thread ,return return; pStatusBar = (CMFCStatusBar *) AfxGetMainWnd()->GetDescendantWindow(AFX_IDW_STATUS_BAR); pStatusBar->SetPaneText(nIndext,str.GetString()); }
void GcEditorSequenceMain::OnEnChangeSequencename() { CString strTemp; mEtSequenceName.GetWindowText( strTemp ); GtConvertString strName = strTemp.GetString(); mpSequence->SetObjectName( strName.GetAciiString() ); CheckEnableOKButton(); }
LRESULT CDlgAutoRegister::OnInsertString( WPARAM wParam, LPARAM lParam ) { //LPCTSTR lpString = (LPCTSTR)wParam; //m_listBox.InsertString(0, lpString); CString* pStr = (CString*)wParam; m_listBox.InsertString(0, pStr->GetString()); delete pStr; return 0; }
void CDlgChairNum::OnBnClickedOk() { CString text; m_ChairNum.GetWindowText(text); chair = strtoul(text.GetString(), NULL, 10); OnOK(); }
void CProject3Dlg::OnBnClickedButtonStartConsole() { CString text; m_eDllLoadsN.GetWindowTextW(text); if (text.IsEmpty()) return; int dll_loads_count = std::stoi(text.GetString()); m_eObjectsN.GetWindowTextW(text); if (text.IsEmpty()) return; int obj_count = std::stoi(text.GetString()); std::wstring process_to_start(L"Project2.exe"); std::wstring args = std::to_wstring(dll_loads_count) + L" " + std::to_wstring(obj_count) + L" " + std::to_wstring((int)m_hWnd); SHELLEXECUTEINFO shellExInfo; shellExInfo.cbSize = sizeof(SHELLEXECUTEINFO); shellExInfo.fMask = SEE_MASK_NOCLOSEPROCESS; shellExInfo.hwnd = NULL; shellExInfo.lpVerb = L"open"; shellExInfo.lpFile = process_to_start.c_str(); shellExInfo.lpParameters = args.c_str(); shellExInfo.lpDirectory = L".\\"; shellExInfo.nShow = SW_SHOW; shellExInfo.hInstApp = NULL; // start process if (!ShellExecuteEx(&shellExInfo)) { MessageBox(_T("Can't start console"), _T("Error"), NULL); return; } // retrieve PID if (!GetProcessId(shellExInfo.hProcess)) { MessageBox(_T("Error while GetProcessId()"), _T("Error"), NULL); return; } m_hConsoleProcess = shellExInfo.hProcess; ConsoleThreadProcData* data = new ConsoleThreadProcData(); data->m_hConsoleProcess = m_hConsoleProcess; data->m_hWnd = m_hWnd; AfxBeginThread(ConsoleThreadProc, data); }
INT CRealNameBase::OnRealNameMsg(UINT nMsgType, LPVOID lpData /*= NULL*/, DWORD dwLen /*= 0*/) { UNIT_TRACE("CRealNameBase::OnRealNameMsg(...)"); if (DoHasLocalRealName(nMsgType, lpData, dwLen)) { return -1; } if (99 == nMsgType) //自定义 { if (lpData != NULL) { CString* pStr = (CString*)lpData; CheckCard(pStr->GetString()); if (m_nMemberId > 0) { m_NetBarUser.SetMemberId(m_nMemberId); // 2011/05/17-gxx: m_NetBarUser.SetNetId(*pStr); QueryBalance(); OnOldUser(m_NetBarUser); } } } else if (999 == nMsgType) { ReadUserInfo(m_NetBarUser); m_NetBarUser.GetNetId(); if (!CheckCard(m_NetBarUser.GetNetId())) { return 0; } if (m_nMemberId > 0) //老卡,先激活 { m_NetBarUser.SetMemberId(m_nMemberId); QueryBalance(); OnOldUser(m_NetBarUser); } else //新卡,计费未注册 { OnNewUser(m_NetBarUser); } } return 0; }
int CGit::RunAsync(CString cmd,PROCESS_INFORMATION *piOut,HANDLE *hReadOut,CString *StdioFile) { SECURITY_ATTRIBUTES sa; HANDLE hRead, hWrite; HANDLE hStdioFile = NULL; sa.nLength = sizeof(SECURITY_ATTRIBUTES); sa.lpSecurityDescriptor=NULL; sa.bInheritHandle=TRUE; if(!CreatePipe(&hRead,&hWrite,&sa,0)) { return GIT_ERROR_OPEN_PIP; } if(StdioFile) { hStdioFile=CreateFile(*StdioFile,GENERIC_WRITE,FILE_SHARE_READ | FILE_SHARE_WRITE, &sa,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL); } STARTUPINFO si; PROCESS_INFORMATION pi; si.cb=sizeof(STARTUPINFO); GetStartupInfo(&si); si.hStdError=hWrite; if(StdioFile) si.hStdOutput=hStdioFile; else si.hStdOutput=hWrite; si.wShowWindow=SW_HIDE; si.dwFlags=STARTF_USESTDHANDLES|STARTF_USESHOWWINDOW; LPTSTR pEnv = l_processEnv; DWORD dwFlags = pEnv ? CREATE_UNICODE_ENVIRONMENT : 0; if(!CreateProcess(NULL,(LPWSTR)cmd.GetString(), NULL,NULL,TRUE,dwFlags,pEnv,(LPWSTR)m_CurrentDir.GetString(),&si,&pi)) { LPVOID lpMsgBuf; FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM, NULL,GetLastError(),MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR)&lpMsgBuf, 0,NULL); return GIT_ERROR_CREATE_PROCESS; } CloseHandle(hWrite); if(piOut) *piOut=pi; if(hReadOut) *hReadOut=hRead; return 0; }
void CHawkeye_clientApp::DisConnectServ() { CString dtime; _wstrtime((TCHAR*)dtime.GetString()); phe->m_listlog.InsertItem(0,dtime); phe->m_listlog.SetItemText(0,1,L"NETWORK"); phe->m_listlog.SetItemText(0,2,L"Disconnected"); phe->m_listlog.UpdateData(false); isConnect = false; }
CVSFilterApp::CVSFilterApp() { #ifdef __DO_LOG LPTSTR strDLLPath = new TCHAR[_MAX_PATH]; ::GetModuleFileName(reinterpret_cast<HINSTANCE>(&__ImageBase), strDLLPath, _MAX_PATH); CString dllPath = strDLLPath; dllPath += ".properties"; xy_logger::doConfigure(dllPath.GetString()); #endif }
void CDataPool::OnReloadScript() { //加载全局函数 char szExePath[MAX_PATH]; GetModuleFileName(NULL, szExePath,MAX_PATH); std::string ss = szExePath; CString szScriptPath = ss.substr(0,ss.find_last_of('\\')).c_str(); szScriptPath += "/editor_global.lua"; m_scriptModule.DoFile(szScriptPath.GetString()); }
void CWndImageList::UpdateImageList() { SQRWnd* pEditWnd = m_pWndGroup->GetEditWnd(); if( pEditWnd == NULL ) return; IMAGE_PARAM IP ( SM_BS_BK, m_nImageType ); WND_IMAGE_LIST* pImageList = pEditWnd->GetWndBkImage( IP ); if( pImageList == NULL ) return; m_pWndGroup->Check(); int n1 = GetItemCount(); int n2 = pImageList->GetImageCount(); for( int i = 0; i < GetItemCount(); i++ ) { IMAGE& Image = pImageList->GetImage( i ); CString szImageName = Image.pTexture ? gbk_to_utf16(Image.pTexture->GetName()).c_str() : L""; CString itemText = GetItemText(i, 0); if(itemText == szImageName ) continue; Image.dwColor = 0xffffffff; SafeRelease( Image.pTexture ); HRESULT hr = pEditWnd->GetGraphic()->CreateTexture( L"", utf16_to_gbk(itemText.GetString() ).c_str(), &Image.pTexture); if (FAILED(hr)) OutputDebugString(itemText); if ( Image.pTexture ) { Image.texName = utf16_to_gbk(itemText.GetString() ).c_str(); } // 对于 tree 和 list 需要即时更新 if ( pEditWnd->GetClassName() == string( "CListCtrl" )) { SQRListCtrl* pListCtrl = (SQRListCtrl*)pEditWnd; pListCtrl->UpdateItemImage(); } } IMAGE& Image = pImageList->GetImage( m_nEditItem ); m_ImageProp->ResetImageProp( &Image, m_pWndGroup ); m_pWndGroup->ReCheck(); }
void QueryBookDlg::OnQuery() { m_cListCtrl.DeleteAllItems(); vector<Book> books; if (!m_dbUtil.isOpen) { m_dbUtil.OpenDB(); } string strBookName; int nIndex = m_cComBox.GetCurSel(); //wchar_t szName[64] = { 0 }; CString strName; m_cEditName.GetWindowText(strName); //wsprintf(szName, _T("%s"), strName); wstring wstrName = strName.GetString(); strBookName = m_stringConvert.ws2s(wstrName); //根据书名或者作者进行查询 if (nIndex == 0 || nIndex == -1) { m_dbUtil.SelectBookByName(strBookName, books); } else if (nIndex == 1) { m_dbUtil.SelectBookByAuthor(strBookName, books); } vector<Book>::iterator vecIter; int i = 0, j = 0; int number = m_cListCtrl.GetItemCount(); wstring wstrTemp; for (vecIter = books.begin(); vecIter != books.end(); vecIter++) { wchar_t chId[4] = { 0 }; wsprintf(chId, _T("%d"), i + 1); m_cListCtrl.InsertItem(i, chId); m_cListCtrl.SetItemText(i, j++, chId); wstrTemp = m_stringConvert.s2ws(vecIter->GetBookName()); m_cListCtrl.SetItemText(i, j++, wstrTemp.c_str()); wstrTemp = m_stringConvert.s2ws(vecIter->GetAuthor()); m_cListCtrl.SetItemText(i, j++, wstrTemp.c_str()); wstrTemp = m_stringConvert.s2ws(vecIter->GetISBN()); m_cListCtrl.SetItemText(i, j++, wstrTemp.c_str()); wstrTemp = m_stringConvert.s2ws(vecIter->GetPub()); m_cListCtrl.SetItemText(i, j++, wstrTemp.c_str()); wchar_t wstrTotal[4] = { 0 }; wsprintf(wstrTotal, _T("%d"), vecIter->GetTotalNum()); m_cListCtrl.SetItemText(i, j++, wstrTotal); wchar_t wstrLeft[4] = { 0 }; wsprintf(wstrLeft, _T("%d"), vecIter->GetLeftNum()); m_cListCtrl.SetItemText(i, j++, wstrLeft); i ++; j = 0; } }
void CAdhocLinkerDlg::StoreAddress(void) { HKEY hKey; DWORD dwDisp; LSTATUS lRet = RegCreateKeyEx(HKEY_CURRENT_USER, _T("Software\\PSPAdhocLinker"), 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey, &dwDisp); if(lRet != ERROR_SUCCESS) return; CString Value; m_Port.GetWindowText(Value); RegSetValueEx(hKey, _T("Port"), 0, REG_SZ, (LPBYTE)Value.GetString(), (Value.GetLength()+1)*sizeof(TCHAR)); m_Address.GetWindowText(Value); RegSetValueEx(hKey, _T("Address"), 0, REG_SZ, (LPBYTE)Value.GetString(), (Value.GetLength()+1)*sizeof(TCHAR)); RegCloseKey(hKey); }
void CDlg_CPU::OnBnClickedCpuLoad() { CString strBegin; CString strLen; GetDlgItem(IDC_CPU_EDIT_BEGIN)->GetWindowText(strBegin); GetDlgItem(IDC_CPU_EDIT_LEN)->GetWindowText(strLen); DWORD dwBegin = (DWORD)CStrConver::StrToHex(strBegin.GetString()); DWORD dwLen = (DWORD)CStrConver::StrToHex(strLen.GetString()); int nItemId = m_tabSel.GetCurSel(); if (0 == nItemId) { m_ShowData.UpdateUnasm(m_pszMem, m_pmapAsm, dwBegin, dwLen); } else { m_ShowData.UpdateMemory(m_pszMem, dwBegin, dwLen); } }
// Check if a single file name is provided that seems to be an image file. bool CMyStatic::CanLoadFromFile(COleDataObject *pDataObject) const { // Check if there is a HDROP object with a single file name. bool bCanLoadFromFile = (1 == m_DropTarget.GetFileNameCount(pDataObject)); if (bCanLoadFromFile) { bCanLoadFromFile = false; CString str = m_DropTarget.GetSingleFileName(pDataObject); // Check if file exists if (!str.IsEmpty() && INVALID_FILE_ATTRIBUTES != ::GetFileAttributes(str.GetString())) { // Check file extension. // This is a rather simple check. // A full check may get the file type by reading the first bytes from the file. bCanLoadFromFile = IsSupportedFileExtension(str.GetString()); } } return bCanLoadFromFile; }
void CFormula::ParseHandList(const CString &list_text, bool inlist[13][13]) { CSLock lock(m_critsec); for (int i=0; i<=12; i++) for (int j=0; j<=12; j++) inlist[i][j] = false; int token_card0_rank = 0, token_card1_rank = 0, temp_rank = 0; CString list = list_text; list.MakeUpper(); const char *pStr = list.GetString(); while (*pStr) { if (pStr[0] == '/' && pStr[1] == '/') { int index = CString(pStr).FindOneOf("\r\n"); if (index == -1) break; pStr += index; } token_card0_rank = CardIdentHelper(*pStr++); if (token_card0_rank == -1) continue; token_card1_rank = CardIdentHelper(*pStr++); if (token_card0_rank == -1) continue; // make card0 have the higher rank if (token_card0_rank < token_card1_rank) { temp_rank = token_card0_rank; token_card0_rank = token_card1_rank; token_card1_rank = temp_rank; } if (*pStr == 'S') // suited { inlist[token_card0_rank][token_card1_rank] = true; pStr++; } else // offsuit or pair { inlist[token_card1_rank][token_card0_rank] = true; } } }
void CDlgSAPrefs16::OnOK() { CString text = ""; prefs.set_rebuy_condition_no_cards(_rebuy_condition_no_cards_Button.GetCheck() == true); prefs.set_rebuy_condition_change_in_handnumber(_rebuy_condition_change_in_handnumber_Button.GetCheck() == true); prefs.set_rebuy_condition_heuristic_check_for_occlusion(_rebuy_condition_heuristic_check_for_occlusion_Button.GetCheck() == true); _rebuy_minimum_time_to_next_try_Edit.GetWindowText(text); if (strtoul(text.GetString(), 0, 10)<0 || strtoul(text.GetString(), 0, 10)>MAX_MINIMUM_DELAY_TO_NEXT_REBUY) { OH_MessageBox_Interactive("Invalid minimum time to next rebuy", "ERROR", MB_OK); return; } prefs.set_rebuy_minimum_time_to_next_try(strtoul(text.GetString(), 0, 10)); _rebuy_script_Edit.GetWindowText(text); prefs.set_rebuy_script(text); CSAPrefsSubDlg::OnOK(); }
void CChatSelector::SendMessagePacket(CChatItem &ci, const CString &strMessage) { uint16 uMessageLen = strMessage.GetLength(); Packet *pPacket = new Packet(OP_MESSAGE, uMessageLen + 2); memcpy2(pPacket->m_pcBuffer, &uMessageLen, 2); //<messagelen 2> memcpy2(pPacket->m_pcBuffer + 2, strMessage.GetString(), uMessageLen); //(<messagechar 1>)*messagelen g_App.m_pUploadQueue->AddUpDataOverheadOther(pPacket->m_dwSize); #ifdef OLD_SOCKETS_ENABLED ci.m_pClient->m_pRequestSocket->SendPacket(pPacket, true, true); #endif //OLD_SOCKETS_ENABLED }
CString CFilenames::PureExecutableFilename() { CString filename = ExecutableFilename(); int pos = filename.ReverseFind('.'); CString result; if (pos > 0) { result = filename.Left(pos); } else { result = filename; } Log("PureExecutableFilename", result.GetString()); return result; }
void UpdateUrlDlg::saveData() { // get the editbox CWnd* editbox = FromHandle(::GetDlgItem(GetSafeHwnd(), IDC_PREFIX_EDIT)); if (editbox) { const CString text = getWindowText(*editbox); String updateUrlPrefix = String(text.GetString()); ToolbarSettings::getInstance().writeValue( TO_UPDATEURLPREFIX, updateUrlPrefix); editbox->Detach(); } }
void CDlgEditFont::OnBnClickedSort() { STablemapFont temp; CString text; int size = (int) new_t$_recs[group]->GetSize(); // Bubble sort em for (int i=0; i<size-1; i++) { for (int j=i+1; j<size; j++) { STablemapFont &i_fontrec = new_t$_recs[group]->ElementAt(i); STablemapFont &j_fontrec = new_t$_recs[group]->ElementAt(j); if (j_fontrec.ch < i_fontrec.ch) { // hold i rec in temp temp.ch = i_fontrec.ch; temp.x_count = i_fontrec.x_count; for (int k=0; k<i_fontrec.x_count; k++) temp.x[k] = i_fontrec.x[k]; temp.hexmash = i_fontrec.hexmash; // copy j rec to i rec i_fontrec.ch = j_fontrec.ch; i_fontrec.x_count = j_fontrec.x_count; for (int k=0; k<j_fontrec.x_count; k++) i_fontrec.x[k] = j_fontrec.x[k]; i_fontrec.hexmash = j_fontrec.hexmash; // copy temp to j rec j_fontrec.ch = temp.ch; j_fontrec.x_count = temp.x_count; for (int k=0; k<temp.x_count; k++) j_fontrec.x[k] = temp.x[k]; j_fontrec.hexmash = temp.hexmash; } } } // Clear and re-populate list box m_CharList.ResetContent(); for (int i=0; i < size; i++) { STablemapFont &fontrec = new_t$_recs[group]->ElementAt(i); text.Format("%c", fontrec.ch); m_CharList.AddString(text.GetString()); } // Select first item in list box m_CharList.SetCurSel(0); OnLbnSelchangeCharlist(); m_CharList.SetFocus(); }
// Need special token void XMLParser::NeedToken(char p_token) { if(*m_pointer && *m_pointer == p_token) { m_pointer++; return; } CString error; error.Format("Missing token [%c:%02X]",p_token,(unsigned char)p_token); SetError(XmlError::XE_MissingToken,(uchar*)error.GetString()); }
void CMainFrame::OnFileOpen() { CFileDialog dlg(TRUE, NULL, NULL, 0, _T("zpack files (*.zpk)|*.zpk|All Files (*.*)|*.*||")); if (dlg.DoModal() != IDOK) { return; } CzpEditorDoc* document = (CzpEditorDoc*)GetActiveDocument(); document->OnOpenDocument(dlg.GetPathName()); CString title = dlg.GetFileName() + _T(" - zpEditor"); this->SetWindowText(title.GetString()); }
void CClientMain::OnScreenShot() { CxImage ScreenImage = m_ScreenDisplayer.GetDisplayImage(); //if (ScreenImage.CreateFromHBITMAP(m_ScreenDisplayer.GetDisplayImage())) { ScreenImage.SetJpegQuality(m_dlgSetup.GetImageQuality()); TCHAR filter[] = _T("(*.bmp)|*.bmp |(*.gif)|*.gif|(*.jpg)|*.jpg|(*.png)|*.png|(*.tif)|*.tif|(*.tga)|*.tga|(*.pcx)|*.pcx|(*.wbmp)|*.wbmp|(*.wmf)|*.wmf|(*.jp2)|*.jp2|(*.jpc)|*.jpc|(*.pgx)|*.pgx|(*.raw)|*.raw||"); CFileDialog SaveDlg(false,NULL,NULL,OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT,filter); if (IDOK == SaveDlg.DoModal()) { CString FilePathName = SaveDlg.GetPathName(); std::map<int,const wchar_t* const> mapFileExt;//保存所要用到的文件后缀名 std::map<int,DWORD> mapSaveType;//保存所要的图片保存类型对应的CxImage宏 mapFileExt.insert(std::make_pair(1,_T(".bmp"))); mapFileExt.insert(std::make_pair(2,_T(".gif"))); mapFileExt.insert(std::make_pair(3,_T(".jpg"))); mapFileExt.insert(std::make_pair(4,_T(".png"))); mapFileExt.insert(std::make_pair(5,_T(".tif"))); mapFileExt.insert(std::make_pair(6,_T(".tga"))); mapFileExt.insert(std::make_pair(7,_T(".pcx"))); mapFileExt.insert(std::make_pair(8,_T(".wbmp"))); mapFileExt.insert(std::make_pair(9,_T(".wmf"))); mapFileExt.insert(std::make_pair(10,_T(".jp2"))); mapFileExt.insert(std::make_pair(11,_T(".jpc"))); mapFileExt.insert(std::make_pair(12,_T(".pgx"))); mapFileExt.insert(std::make_pair(13,_T(".raw"))); mapSaveType.insert(std::make_pair(1,CXIMAGE_FORMAT_BMP)); mapSaveType.insert(std::make_pair(2,CXIMAGE_FORMAT_GIF)); mapSaveType.insert(std::make_pair(3,CXIMAGE_FORMAT_JPG)); mapSaveType.insert(std::make_pair(4,CXIMAGE_FORMAT_PNG)); mapSaveType.insert(std::make_pair(5,CXIMAGE_FORMAT_TIF)); mapSaveType.insert(std::make_pair(6,CXIMAGE_FORMAT_TGA)); mapSaveType.insert(std::make_pair(7,CXIMAGE_FORMAT_PCX)); mapSaveType.insert(std::make_pair(8,CXIMAGE_FORMAT_WBMP)); mapSaveType.insert(std::make_pair(9,CXIMAGE_FORMAT_WMF)); mapSaveType.insert(std::make_pair(10,CXIMAGE_FORMAT_JP2)); mapSaveType.insert(std::make_pair(11,CXIMAGE_FORMAT_JPC)); mapSaveType.insert(std::make_pair(12,CXIMAGE_FORMAT_PGX)); mapSaveType.insert(std::make_pair(13,CXIMAGE_FORMAT_RAW)); int nFileExt = SaveDlg.m_ofn.nFilterIndex; const wchar_t *const tFileExt = mapFileExt[nFileExt]; DWORD dwSaveType = mapSaveType[nFileExt]; if(FilePathName.Right(4) !=tFileExt) { FilePathName += tFileExt; ScreenImage.Save(FilePathName.GetString() ,dwSaveType); } } } }
mpt::PathString PathString::TunnelOutofCString(const CString &path) //----------------------------------------------------------------- { #ifdef UNICODE return mpt::PathString::FromWide(path.GetString()); #else // Since MFC code can call into our code from a lot of places, we cannot assume // that filenames we get from MFC are always encoded in our hacked UTF8-in-CString encoding. // Instead, we use a rough heuristic: if the string is parseable as UTF8, we assume it is. // This fails for CP_ACP strings, that are also valid UTF8. That's the trade-off here. if(mpt::IsUTF8(path.GetString())) { // utf8 return mpt::PathString::FromUTF8(path.GetString()); } else { // ANSI return mpt::PathString::FromWide(mpt::ToWide(path)); } #endif }
void CDlgSAPrefs8::OnOK() { CString text = ""; prefs.set_replay_record(m_RecordFrames.GetCheck() == BST_CHECKED); prefs.set_replay_record_every_change(m_RecordEveryChange.GetCheck() == BST_CHECKED); m_MaxFrames.GetWindowText(text); prefs.set_replay_max_frames(atoi(text.GetString())); CSAPrefsSubDlg::OnOK(); }
void CRtsSettingsDlg::OnBnClickedOk() { regHandler.SetInt("TreeRadius",TreeDist.GetPos()); regHandler.SetInt("GroundDetail",TerrainLod.GetPos()); regHandler.SetInt("UnitLodDist",UnitLodDist.GetPos()); regHandler.SetInt("UnitIconDist", UnitIconDist.GetPos()); regHandler.SetInt("SM3MaxTextureStages", Sm3MaxTextureStages.GetPos()); regHandler.SetInt("GrassDetail",GrassDetail.GetPos()); regHandler.SetInt("MaxParticles",Particles.GetPos()); regHandler.SetInt("ShadowMapSize",shadowMapSize.GetPos()*1024); regHandler.SetInt("MaxSounds",maxSounds.GetPos()); regHandler.SetInt("GroundDecals",GroundDecals.GetPos()); regHandler.SetInt("VerboseLevel",VerboseLevel.GetPos()); regHandler.SetInt("SoundVolume",SoundVolume.GetPos()); regHandler.SetInt("UnitReplySoundVolume",UnitReplySoundVolume.GetPos()); char text[500]; xres.GetWindowText(text,500); regHandler.SetInt("XResolution",atoi(text)); yres.GetWindowText(text,500); regHandler.SetInt("YResolution",atoi(text)); regHandler.SetInt("3DTrees",AdvTree.GetCheck()); regHandler.SetInt("AdvSky",AdvCloud.GetCheck()); regHandler.SetInt("DynamicSky",DynCloud.GetCheck()); regHandler.SetInt("Fullscreen",Fullscreen.GetCheck()); regHandler.SetInt("ColorElev",ColorElev.GetCheck()); regHandler.SetInt("Shadows",shadows.GetCheck()); regHandler.SetInt("SimpleMiniMapColors",simpleColors.GetCheck()); regHandler.SetInt("CatchAIExceptions",CatchAIExceptions.GetCheck()); regHandler.SetInt("AdvUnitShading",AdvUnitRendering.GetCheck()); regHandler.SetInt("SM3ForceFallbackTex", Sm3ForceFallbackTex.GetCheck()); regHandler.SetInt("VSync", vsync.GetCheck()); regHandler.SetInt("DepthBufferBits", zbits16.GetCheck() ? 16 : 24); int fsaaLevel=FSAASamples.GetPos(); if (fsaaLevel>1) { regHandler.SetInt("FSAALevel", fsaaLevel); regHandler.SetInt("FSAA", 1); } else regHandler.SetInt("FSAA", 0); if(Water2.GetCheck()) regHandler.SetInt("ReflectiveWater",2); if(Water1.GetCheck()) regHandler.SetInt("ReflectiveWater",1); if(Water0.GetCheck()) regHandler.SetInt("ReflectiveWater",0); if(Water3.GetCheck()) regHandler.SetInt("ReflectiveWater",3); CString s; PlayerName.GetWindowText(s); regHandler.SetString("name",s.GetString()); OnOK(); }