void CZSingleton::SetDrop() { CString gg(AfxGetApp()->m_pszExeName); ::SetProp(AfxGetApp()->GetMainWnd()->GetSafeHwnd(), gg, (HANDLE)1); gg.Empty(); }
// CTortoiseMergeApp initialization BOOL CTortoiseMergeApp::InitInstance() { SetDllDirectory(L""); SetTaskIDPerUUID(); CCrashReport::Instance().AddUserInfoToReport(L"CommandLine", GetCommandLine()); { DWORD len = GetCurrentDirectory(0, nullptr); if (len) { auto originalCurrentDirectory = std::make_unique<TCHAR[]>(len); if (GetCurrentDirectory(len, originalCurrentDirectory.get())) { sOrigCWD = originalCurrentDirectory.get(); sOrigCWD = CPathUtils::GetLongPathname(sOrigCWD); } } } //set the resource dll for the required language CRegDWORD loc = CRegDWORD(L"Software\\TortoiseSVN\\LanguageID", 1033); long langId = loc; CString langDll; HINSTANCE hInst = nullptr; do { langDll.Format(L"%sLanguages\\TortoiseMerge%ld.dll", (LPCTSTR)CPathUtils::GetAppParentDirectory(), langId); hInst = LoadLibrary(langDll); CString sVer = _T(STRPRODUCTVER); CString sFileVer = CPathUtils::GetVersionFromFile(langDll); if (sFileVer.Compare(sVer)!=0) { FreeLibrary(hInst); hInst = nullptr; } if (hInst) AfxSetResourceHandle(hInst); else { DWORD lid = SUBLANGID(langId); lid--; if (lid > 0) { langId = MAKELANGID(PRIMARYLANGID(langId), lid); } else langId = 0; } } while ((!hInst) && (langId != 0)); TCHAR buf[6] = { 0 }; wcscpy_s(buf, L"en"); langId = loc; CString sHelppath; sHelppath = this->m_pszHelpFilePath; sHelppath = sHelppath.MakeLower(); sHelppath.Replace(L".chm", L"_en.chm"); free((void*)m_pszHelpFilePath); m_pszHelpFilePath=_wcsdup(sHelppath); sHelppath = CPathUtils::GetAppParentDirectory() + L"Languages\\TortoiseMerge_en.chm"; do { GetLocaleInfo(MAKELCID(langId, SORT_DEFAULT), LOCALE_SISO639LANGNAME, buf, _countof(buf)); CString sLang = L"_"; sLang += buf; sHelppath.Replace(L"_en", sLang); if (PathFileExists(sHelppath)) { free((void*)m_pszHelpFilePath); m_pszHelpFilePath=_wcsdup(sHelppath); break; } sHelppath.Replace(sLang, L"_en"); GetLocaleInfo(MAKELCID(langId, SORT_DEFAULT), LOCALE_SISO3166CTRYNAME, buf, _countof(buf)); sLang += L"_"; sLang += buf; sHelppath.Replace(L"_en", sLang); if (PathFileExists(sHelppath)) { free((void*)m_pszHelpFilePath); m_pszHelpFilePath=_wcsdup(sHelppath); break; } sHelppath.Replace(sLang, L"_en"); DWORD lid = SUBLANGID(langId); lid--; if (lid > 0) { langId = MAKELANGID(PRIMARYLANGID(langId), lid); } else langId = 0; } while (langId); setlocale(LC_ALL, ""); // We need to explicitly set the thread locale to the system default one to avoid possible problems with saving files in its original codepage // The problems occures when the language of OS differs from the regional settings // See the details here: http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=100887 SetThreadLocale(LOCALE_SYSTEM_DEFAULT); // InitCommonControls() is required on Windows XP if an application // manifest specifies use of ComCtl32.dll version 6 or later to enable // visual styles. Otherwise, any window creation will fail. InitCommonControls(); CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerWindows)); CMFCVisualManagerWindows::m_b3DTabsXPTheme = TRUE; CMFCButton::EnableWindowsTheming(); EnableTaskbarInteraction(FALSE); // Initialize all Managers for usage. They are automatically constructed // if not yet present InitContextMenuManager(); InitKeyboardManager(); InitTooltipManager (); CMFCToolTipInfo params; params.m_bVislManagerTheme = TRUE; GetTooltipManager ()->SetTooltipParams ( AFX_TOOLTIP_TYPE_ALL, RUNTIME_CLASS (CMFCToolTipCtrl), ¶ms); CCmdLineParser parser = CCmdLineParser(this->m_lpCmdLine); g_sGroupingUUID = parser.GetVal(L"groupuuid"); if (parser.HasKey(L"?") || parser.HasKey(L"help")) { CString sHelpText; sHelpText.LoadString(IDS_COMMANDLINEHELP); MessageBox(nullptr, sHelpText, L"TortoiseMerge", MB_ICONINFORMATION); return FALSE; } // Initialize OLE libraries if (!AfxOleInit()) { AfxMessageBox(IDP_OLE_INIT_FAILED); return FALSE; } AfxEnableControlContainer(); // Standard initialization // If you are not using these features and wish to reduce the size // of your final executable, you should remove from the following // the specific initialization routines you do not need // Change the registry key under which our settings are stored SetRegistryKey(L"TortoiseMerge"); if (CRegDWORD(L"Software\\TortoiseMerge\\Debug", FALSE)==TRUE) AfxMessageBox(AfxGetApp()->m_lpCmdLine, MB_OK | MB_ICONINFORMATION); // To create the main window, this code creates a new frame window // object and then sets it as the application's main window object CMainFrame* pFrame = new CMainFrame; if (!pFrame) return FALSE; m_pMainWnd = pFrame; // create and load the frame with its resources if (!pFrame->LoadFrame(IDR_MAINFRAME, WS_OVERLAPPEDWINDOW | FWS_ADDTOTITLE, nullptr, nullptr)) return FALSE; // Fill in the command line options pFrame->m_Data.m_baseFile.SetFileName(parser.GetVal(L"base")); pFrame->m_Data.m_baseFile.SetDescriptiveName(parser.GetVal(L"basename")); pFrame->m_Data.m_baseFile.SetReflectedName(parser.GetVal(L"basereflectedname")); pFrame->m_Data.m_theirFile.SetFileName(parser.GetVal(L"theirs")); pFrame->m_Data.m_theirFile.SetDescriptiveName(parser.GetVal(L"theirsname")); pFrame->m_Data.m_theirFile.SetReflectedName(parser.GetVal(L"theirsreflectedname")); pFrame->m_Data.m_yourFile.SetFileName(parser.GetVal(L"mine")); pFrame->m_Data.m_yourFile.SetDescriptiveName(parser.GetVal(L"minename")); pFrame->m_Data.m_yourFile.SetReflectedName(parser.GetVal(L"minereflectedname")); pFrame->m_Data.m_mergedFile.SetFileName(parser.GetVal(L"merged")); pFrame->m_Data.m_mergedFile.SetDescriptiveName(parser.GetVal(L"mergedname")); pFrame->m_Data.m_mergedFile.SetReflectedName(parser.GetVal(L"mergedreflectedname")); pFrame->m_Data.m_sPatchPath = parser.HasVal(L"patchpath") ? parser.GetVal(L"patchpath") : L""; pFrame->m_Data.m_sPatchPath.Replace('/', '\\'); if (parser.HasKey(L"patchoriginal")) pFrame->m_Data.m_sPatchOriginal = parser.GetVal(L"patchoriginal"); if (parser.HasKey(L"patchpatched")) pFrame->m_Data.m_sPatchPatched = parser.GetVal(L"patchpatched"); pFrame->m_Data.m_sDiffFile = parser.GetVal(L"diff"); pFrame->m_Data.m_sDiffFile.Replace('/', '\\'); if (parser.HasKey(L"oneway")) pFrame->m_bOneWay = TRUE; if (parser.HasKey(L"diff")) pFrame->m_bOneWay = FALSE; if (parser.HasKey(L"reversedpatch")) pFrame->m_bReversedPatch = TRUE; if (parser.HasKey(L"saverequired")) pFrame->m_bSaveRequired = true; if (parser.HasKey(L"saverequiredonconflicts")) pFrame->m_bSaveRequiredOnConflicts = true; if (parser.HasKey(L"nosvnresolve")) pFrame->m_bAskToMarkAsResolved = false; if (pFrame->m_Data.IsBaseFileInUse() && !pFrame->m_Data.IsYourFileInUse() && pFrame->m_Data.IsTheirFileInUse()) { pFrame->m_Data.m_yourFile.TransferDetailsFrom(pFrame->m_Data.m_theirFile); } if ((!parser.HasKey(L"patchpath"))&&(parser.HasVal(L"diff"))) { // a patchfile was given, but not folder path to apply the patch to // If the patchfile is located inside a working copy, then use the parent directory // of the patchfile as the target directory, otherwise ask the user for a path. if (parser.HasKey(L"wc")) pFrame->m_Data.m_sPatchPath = pFrame->m_Data.m_sDiffFile.Left(pFrame->m_Data.m_sDiffFile.ReverseFind('\\')); else { CBrowseFolder fbrowser; fbrowser.m_style = BIF_EDITBOX | BIF_NEWDIALOGSTYLE | BIF_RETURNFSANCESTORS | BIF_RETURNONLYFSDIRS; if (fbrowser.Show(nullptr, pFrame->m_Data.m_sPatchPath) == CBrowseFolder::CANCEL) return FALSE; } } if ((parser.HasKey(L"patchpath"))&&(!parser.HasVal(L"diff"))) { // A path was given for applying a patchfile, but // the patchfile itself was not. // So ask the user for that patchfile HRESULT hr; // Create a new common save file dialog CComPtr<IFileOpenDialog> pfd; hr = pfd.CoCreateInstance(CLSID_FileOpenDialog, nullptr, CLSCTX_INPROC_SERVER); if (SUCCEEDED(hr)) { // Set the dialog options DWORD dwOptions; if (SUCCEEDED(hr = pfd->GetOptions(&dwOptions))) { hr = pfd->SetOptions(dwOptions | FOS_FILEMUSTEXIST | FOS_FORCEFILESYSTEM | FOS_PATHMUSTEXIST); } // Set a title if (SUCCEEDED(hr)) { CString temp; temp.LoadString(IDS_OPENDIFFFILETITLE); pfd->SetTitle(temp); } CSelectFileFilter fileFilter(IDS_PATCHFILEFILTER); hr = pfd->SetFileTypes(fileFilter.GetCount(), fileFilter); bool bAdvised = false; DWORD dwCookie = 0; CComObjectStackEx<PatchOpenDlgEventHandler> cbk; CComQIPtr<IFileDialogEvents> pEvents = cbk.GetUnknown(); { CComPtr<IFileDialogCustomize> pfdCustomize; hr = pfd.QueryInterface(&pfdCustomize); if (SUCCEEDED(hr)) { // check if there's a unified diff on the clipboard and // add a button to the fileopen dialog if there is. UINT cFormat = RegisterClipboardFormat(L"TSVN_UNIFIEDDIFF"); if ((cFormat) && (OpenClipboard(nullptr))) { HGLOBAL hglb = GetClipboardData(cFormat); if (hglb) { pfdCustomize->AddPushButton(101, CString(MAKEINTRESOURCE(IDS_PATCH_COPYFROMCLIPBOARD))); hr = pfd->Advise(pEvents, &dwCookie); bAdvised = SUCCEEDED(hr); } CloseClipboard(); } } } // Show the save file dialog if (SUCCEEDED(hr) && SUCCEEDED(hr = pfd->Show(pFrame->m_hWnd))) { // Get the selection from the user CComPtr<IShellItem> psiResult; hr = pfd->GetResult(&psiResult); if (bAdvised) pfd->Unadvise(dwCookie); if (SUCCEEDED(hr)) { PWSTR pszPath = nullptr; hr = psiResult->GetDisplayName(SIGDN_FILESYSPATH, &pszPath); if (SUCCEEDED(hr)) { pFrame->m_Data.m_sDiffFile = pszPath; CoTaskMemFree(pszPath); } } else { // no result, which means we closed the dialog in our button handler std::wstring sTempFile; if (TrySavePatchFromClipboard(sTempFile)) pFrame->m_Data.m_sDiffFile = sTempFile.c_str(); } } else { if (bAdvised) pfd->Unadvise(dwCookie); return FALSE; } } } if ( pFrame->m_Data.m_baseFile.GetFilename().IsEmpty() && pFrame->m_Data.m_yourFile.GetFilename().IsEmpty() ) { int nArgs; LPWSTR *szArglist = CommandLineToArgvW(GetCommandLineW(), &nArgs); if (!szArglist) TRACE("CommandLineToArgvW failed\n"); else { if ( nArgs==3 || nArgs==4 ) { // Four parameters: // [0]: Program name // [1]: BASE file // [2]: my file // [3]: THEIR file (optional) // This is the same format CAppUtils::StartExtDiff // uses if %base and %mine are not set and most // other diff tools use it too. if ( PathFileExists(szArglist[1]) && PathFileExists(szArglist[2]) ) { pFrame->m_Data.m_baseFile.SetFileName(szArglist[1]); pFrame->m_Data.m_yourFile.SetFileName(szArglist[2]); if ( nArgs == 4 && PathFileExists(szArglist[3]) ) { pFrame->m_Data.m_theirFile.SetFileName(szArglist[3]); } } } else if (nArgs == 2) { // only one path specified: use it to fill the "open" dialog if (PathFileExists(szArglist[1])) { pFrame->m_Data.m_yourFile.SetFileName(szArglist[1]); pFrame->m_Data.m_yourFile.StoreFileAttributes(); } } } // Free memory allocated for CommandLineToArgvW arguments. LocalFree(szArglist); } pFrame->m_bReadOnly = !!parser.HasKey(L"readonly"); if (GetFileAttributes(pFrame->m_Data.m_yourFile.GetFilename()) & FILE_ATTRIBUTE_READONLY) pFrame->m_bReadOnly = true; pFrame->m_bBlame = !!parser.HasKey(L"blame"); // diffing a blame means no editing! if (pFrame->m_bBlame) pFrame->m_bReadOnly = true; pFrame->SetWindowTitle(); if (parser.HasKey(L"createunifieddiff")) { // user requested to create a unified diff file CString origFile = parser.GetVal(L"origfile"); CString modifiedFile = parser.GetVal(L"modifiedfile"); if (!origFile.IsEmpty() && !modifiedFile.IsEmpty()) { CString outfile = parser.GetVal(L"outfile"); if (outfile.IsEmpty()) { CCommonAppUtils::FileOpenSave(outfile, nullptr, IDS_SAVEASTITLE, IDS_COMMONFILEFILTER, false, nullptr); } if (!outfile.IsEmpty()) { CRegStdDWORD regContextLines(L"Software\\TortoiseMerge\\ContextLines", 0); CAppUtils::CreateUnifiedDiff(origFile, modifiedFile, outfile, regContextLines, true, false); return FALSE; } } } pFrame->resolveMsgWnd = parser.HasVal(L"resolvemsghwnd") ? (HWND)parser.GetLongLongVal(L"resolvemsghwnd") : 0; pFrame->resolveMsgWParam = parser.HasVal(L"resolvemsgwparam") ? (WPARAM)parser.GetLongLongVal(L"resolvemsgwparam") : 0; pFrame->resolveMsgLParam = parser.HasVal(L"resolvemsglparam") ? (LPARAM)parser.GetLongLongVal(L"resolvemsglparam") : 0; // The one and only window has been initialized, so show and update it pFrame->ActivateFrame(); pFrame->ShowWindow(SW_SHOW); pFrame->UpdateWindow(); pFrame->ShowDiffBar(!pFrame->m_bOneWay); if (!pFrame->m_Data.IsBaseFileInUse() && pFrame->m_Data.m_sPatchPath.IsEmpty() && pFrame->m_Data.m_sDiffFile.IsEmpty()) { pFrame->OnFileOpen(pFrame->m_Data.m_yourFile.InUse()); return TRUE; } int line = -2; if (parser.HasVal(L"line")) { line = parser.GetLongVal(L"line"); line--; // we need the index } return pFrame->LoadViews(line); }
void CTrayDialog::TraySetIcon(LPCTSTR lpszResourceName) { TraySetIcon(AfxGetApp()->LoadIcon(lpszResourceName)); }
// 现场数据对象初始化 void CSensorListCtrl::OnSiteDataInit() { data_base_helper_ = ((CLineApp*)AfxGetApp())->get_data_base_helper(); }
BOOL COptionsDialog::OnInitDialog() { CDialog::OnInitDialog(); CGeneralManager * m = ((CReportAsistentApp *) AfxGetApp())->m_pGeneralManager; CReportAsistentApp * App = ((CReportAsistentApp *) AfxGetApp()); //Set Language radio buttons if (m->getLanguage() == CString("cz")) CheckRadioButton(IDC_CZECH_RADIO, IDC_ENGLISH_RADIO, IDC_CZECH_RADIO); else CheckRadioButton(IDC_CZECH_RADIO, IDC_ENGLISH_RADIO, IDC_ENGLISH_RADIO); //Set Tree Items //Height edit CString Pom; Pom.Format("%d",App->m_iTreeItemHeight); m_HeightEdit.SetWindowText(Pom); m_HeightEdit.SetLimitText(2); //Indent Edit Pom.Format("%d",App->m_iTreeItemIndent); m_IndentEdit.SetWindowText(Pom); m_IndentEdit.SetLimitText(2); m_LinesCheckBox.SetCheck( App->m_bTreeHasLines); m_IdInTreeCheckBox.SetCheck( App->m_bIdInItemName); m_ButtonsCheckBox.SetCheck( App->m_bTreeHasButtons); //Name Length Edit Pom.Format("%d",App->m_iTreeItemNameLength); m_NameLengthEdit.SetWindowText(Pom); m_NameLengthEdit.SetLimitText(3); // Size of text in TextEdit in Text Element dialog Pom.Format("%d",App->m_iTextEditSize); m_TextEditSize.SetWindowText(Pom); m_TextEditSize.SetLimitText(3); //Set orphans radio buttons: CString OrphSol = App->FirstDocumentInFirstTemplate()->GetReportSettings("orphans_solution"); if (OrphSol== CString("ignore")) CheckRadioButton( IDC_IGNORE_RADIO , IDC_SET_DEFAULT_RADIO, IDC_IGNORE_RADIO ); else if (OrphSol== CString("delete")) CheckRadioButton( IDC_IGNORE_RADIO , IDC_SET_DEFAULT_RADIO, IDC_DELETE_RADIO ); else if (OrphSol== CString("set_default")) CheckRadioButton( IDC_IGNORE_RADIO , IDC_SET_DEFAULT_RADIO, IDC_SET_DEFAULT_RADIO ); else { CheckRadioButton( IDC_IGNORE_RADIO , IDC_SET_DEFAULT_RADIO, IDC_IGNORE_RADIO ); App->FirstDocumentInFirstTemplate()->SetReportSettings("orphans_solution","ignore"); } //set mark orphans m_MarkOrphansCheckBox.SetCheck( App->m_bMarkOrphans); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
BOOL CMyEdit::PreTranslateMessage(MSG* pMsg) { if((pMsg->message == WM_KEYDOWN) && (pMsg->wParam == VK_RETURN) && (GetKeyState(VK_SHIFT) >= 0)){ CString strText; GetWindowText(strText); if(!strText.IsEmpty()){ m_aHistory.Add(strText); } ::SendMessage(AfxGetApp()->m_pMainWnd->m_hWnd, UWM_INPUT, 0, 0); } else if((pMsg->message == WM_KEYDOWN) && (pMsg->wParam == VK_RETURN) && (GetKeyState(VK_SHIFT) < 0) && (GetStyle() & ES_MULTILINE)){ CString strText; GetWindowText(strText); strText+="\r\n"; SetWindowText(strText); SetSel(0, -1, FALSE); SetSel(-1, 0, FALSE); return TRUE; } else if((pMsg->message == WM_MOUSEWHEEL || pMsg->message == WM_KEYDOWN) && !m_bEx){ ASSERT(m_pCommands); /////////////////////////////////////////////////////// // Scroll through RCMS commands UP (PAGE UP) /////////////////////////////////////////////////////// if((pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_PRIOR) || (pMsg->message == WM_MOUSEWHEEL && ((short)HIWORD(pMsg->wParam)) > 0)){ if(!m_pCommands) return TRUE; if(m_pCommands->GetSize() == 0) return TRUE; SetSel(0,-1); TCHAR szTempStr[1024]; if(SendMessage(WM_GETTEXT, 1024, (LPARAM)szTempStr)){ //DWORD dwIndex = atol(szTempStr); DWORD dwIndex = SearchRCMSItem(szTempStr); if(dwIndex == 0){ lstrcpy(szTempStr, m_pCommands->GetAt(m_aCommandsNUM - 1)); ReplaceSel(szTempStr, TRUE); SendMessage(WM_KEYDOWN, VK_END, 0); CString strTemp = m_pCommands->GetAt(m_aCommandsNUM - 1); int nStart = strTemp.Find(" ", 0); if(nStart > 0) SetSel(nStart+1, -1, FALSE); return TRUE; } else if((dwIndex == 1) || (dwIndex > m_aCommandsNUM)){ ReplaceSel("", TRUE); } else{ lstrcpy(szTempStr, m_pCommands->GetAt(dwIndex - 2)); ReplaceSel(szTempStr, TRUE); CString strTemp = m_pCommands->GetAt(dwIndex - 2); int nStart = strTemp.Find(" ", 0); SendMessage(WM_KEYDOWN, VK_END, 0); if(nStart > 0) SetSel(nStart+1, -1, FALSE); } return TRUE; } else{ lstrcpy(szTempStr, m_pCommands->GetAt(m_aCommandsNUM - 1)); ReplaceSel(szTempStr, TRUE); SendMessage(WM_KEYDOWN, VK_END, 0); CString strTemp = m_pCommands->GetAt(m_aCommandsNUM - 1); int nStart = strTemp.Find(" ", 0); if(nStart > 0) SetSel(nStart+1, -1, FALSE); return TRUE; } } /////////////////////////////////////////////////////// // RCMS Down (PAGE DOWN) /////////////////////////////////////////////////////// else if(((pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_NEXT) || (pMsg->message == WM_MOUSEWHEEL && ((short)HIWORD(pMsg->wParam)) <= 0)) && !m_bEx){ if(!m_pCommands) return TRUE; if(m_pCommands->GetSize() == 0) return TRUE; SetSel(0,-1); TCHAR szTempStr[1024]; if(SendMessage(WM_GETTEXT, 1024, (LPARAM)szTempStr)){ //DWORD dwIndex = atol(szTempStr); DWORD dwIndex = SearchRCMSItem(szTempStr); if(dwIndex >= m_aCommandsNUM){ ReplaceSel("", TRUE); //Beep(1000, 50); } else{ lstrcpy(szTempStr, m_pCommands->GetAt(dwIndex)); ReplaceSel(szTempStr, TRUE); SendMessage(WM_KEYDOWN, VK_END, 0); CString strTemp = m_pCommands->GetAt(dwIndex); int nStart = strTemp.Find(" ", 0); if(nStart > 0) SetSel(nStart+1, -1, FALSE); } return TRUE; } else{ lstrcpy(szTempStr, m_pCommands->GetAt(0)); ReplaceSel(szTempStr, TRUE); SendMessage(WM_KEYDOWN, VK_END, 0); CString strTemp = m_pCommands->GetAt(0); int nStart = strTemp.Find(" ", 0); if(nStart > 0) SetSel(nStart+1, -1, FALSE); return TRUE; } } /////////////////////////////////////////////////////// // Commands UP UPARROW or MOUSEHWEL UP /////////////////////////////////////////////////////// else if(((pMsg->message == WM_KEYDOWN) && (pMsg->wParam == VK_UP)) && (m_aHistoryNUM != 0) && !m_bEx){ SetSel(0,-1); TCHAR szTempStr[1024]; if(SendMessage(WM_GETTEXT, 1024, (LPARAM)szTempStr)){ DWORD dwIndex = SearchHistory(szTempStr); if(dwIndex == 0){ // Item was not found CString strOut = m_aHistory[m_aHistory.GetSize() - 1]; //Util::ReplaceVars(strOut); lstrcpy(szTempStr, strOut); ReplaceSel(szTempStr, TRUE); SendMessage(WM_KEYDOWN, VK_END, 0); return TRUE; } else if(dwIndex == 1){ // Item found but we are at no1 SetWindowText(""); //Beep(1000, 50); } else{ // item found CString strOut = m_aHistory[dwIndex - 2]; lstrcpy(szTempStr, strOut); ReplaceSel(szTempStr, TRUE); SendMessage(WM_KEYDOWN, VK_END, 0); } return TRUE; } else{ CString strOut = m_aHistory[m_aHistory.GetSize() - 1]; lstrcpy(szTempStr, strOut); ReplaceSel(szTempStr, TRUE); SendMessage(WM_KEYDOWN, VK_END, 0); return TRUE; } } /////////////////////////////////////////////////////// // HISTORY down DOWNARROW or+MOUSEWHEEL DOWN /////////////////////////////////////////////////////// else if((pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_DOWN) && (m_aHistoryNUM != 0) && !m_bEx){ TRACE("HistoryUP %d\n",GetKeyState(VK_LCONTROL)); SetSel(0,-1); TCHAR szTempStr[1024]; if(SendMessage(WM_GETTEXT, 1024, (LPARAM)szTempStr)){ DWORD dwIndex = SearchHistory(szTempStr); if(dwIndex >= (DWORD)m_aHistory.GetSize()){ SetWindowText(""); //Beep(1000, 50); } else{ CString strOut = m_aHistory[dwIndex]; lstrcpy(szTempStr, strOut); SetWindowText(szTempStr); SendMessage(WM_KEYDOWN, VK_END, 0); } return TRUE; } else{ CString strOut = m_aHistory[0]; lstrcpy(szTempStr, strOut); SetWindowText(szTempStr); SendMessage(WM_KEYDOWN, VK_END, 0); return TRUE; } } } return CEdit::PreTranslateMessage(pMsg); }
BOOL CSystemTray::SetIcon(UINT nIDResource) { HICON hIcon = AfxGetApp()->LoadIcon(nIDResource); return SetIcon(hIcon); }
// COpenHoldemApp initialization BOOL COpenHoldemApp::InitInstance() { Scintilla_RegisterClasses(AfxGetInstanceHandle()); // Initialize richedit2 library AfxInitRichEdit2(); // Change class name of Dialog WNDCLASS wc; GetClassInfo(AfxGetInstanceHandle(), "#32770", &wc); wc.lpszClassName = "OpenHoldemFormula"; wc.hIcon = AfxGetApp()->LoadIcon(IDI_ICON1); RegisterClass(&wc); // InitCommonControlsEx() is required on Windows XP if an application // manifest specifies use of ComCtl32.dll version 6 or later to enable // visual styles. Otherwise, any window creation will fail. INITCOMMONCONTROLSEX InitCtrls; InitCtrls.dwSize = sizeof(InitCtrls); // Set this to include all the common control classes you want to use // in your application. InitCtrls.dwICC = ICC_WIN95_CLASSES; InitCommonControlsEx(&InitCtrls); CWinApp::InitInstance(); // Standard initialization // If you are not using these features and wish to reduce the size // of your final executable, you should remove from the following // the specific initialization routines you do not need // Change the registry key under which our settings are stored bool load_from_registry = true; for (int i = 1; i < __argc; i++) { LPCTSTR pszParam = __targv[i]; if (_tcsncmp(pszParam, "/ini:", 5) == 0) { CString path(pszParam+5); path.Replace("~", _startup_path); free((void*)m_pszProfileName); m_pszProfileName = _strdup(path); load_from_registry = false; } if (_tcscmp(pszParam, "/ini") == 0) { CString path; path.Format("%s\\openholdem.ini", _startup_path); free((void*)m_pszProfileName); m_pszProfileName = _strdup(path); load_from_registry = false; } } if (load_from_registry) SetRegistryKey(_T("OpenHoldem")); prefs.LoadPreferences(load_from_registry); // Classes if (!p_sessioncounter) p_sessioncounter = new CSessionCounter; // Start logging immediatelly after the loading the preferences // and initializing the sessioncounter. start_log(); InstanciateAllSingletonsExceptSessionCounter(); // mouse.dll - failure in load is fatal _mouse_dll = LoadLibrary("mouse.dll"); if (_mouse_dll==NULL) { CString t = ""; t.Format("Unable to load mouse.dll, error: %d\n\nExiting.", GetLastError()); OH_MessageBox(t, "OpenHoldem mouse.dll ERROR", MB_OK | MB_TOPMOST); return false; } else { _dll_mouse_process_message = (mouse_process_message_t) GetProcAddress(_mouse_dll, "ProcessMessage"); _dll_mouse_click = (mouse_click_t) GetProcAddress(_mouse_dll, "MouseClick"); _dll_mouse_click_drag = (mouse_clickdrag_t) GetProcAddress(_mouse_dll, "MouseClickDrag"); if (_dll_mouse_process_message==NULL || _dll_mouse_click==NULL || _dll_mouse_click_drag==NULL) { CString t = ""; t.Format("Unable to find all symbols in mouse.dll"); OH_MessageBox(t, "OpenHoldem mouse.dll ERROR", MB_OK | MB_TOPMOST); FreeLibrary(_mouse_dll); _mouse_dll = NULL; return false; } } // keyboard.dll - failure in load is fatal _keyboard_dll = LoadLibrary("keyboard.dll"); if (_keyboard_dll==NULL) { CString t = ""; t.Format("Unable to load keyboard.dll, error: %d\n\nExiting.", GetLastError()); OH_MessageBox(t, "OpenHoldem keyboard.dll ERROR", MB_OK | MB_TOPMOST); return false; } else { _dll_keyboard_process_message = (keyboard_process_message_t) GetProcAddress(_keyboard_dll, "ProcessMessage"); _dll_keyboard_sendstring = (keyboard_sendstring_t) GetProcAddress(_keyboard_dll, "SendString"); _dll_keyboard_sendkey = (keyboard_sendkey_t) GetProcAddress(_keyboard_dll, "SendKey"); if (_dll_keyboard_process_message==NULL || _dll_keyboard_sendstring==NULL || _dll_keyboard_sendkey==NULL) { CString t = ""; t.Format("Unable to find all symbols in keyboard.dll"); OH_MessageBox(t, "OpenHoldem keyboard.dll ERROR", MB_OK | MB_TOPMOST); FreeLibrary(_keyboard_dll); _keyboard_dll = NULL; return false; } } MyLoadStdProfileSettings(4); // Load standard INI file options (including MRU) if (m_pRecentFileList == NULL) AfxMessageBox("Still NULL"); // Register the application's document templates. Document templates // serve as the connection between documents, frame windows and views CSingleDocTemplate* pDocTemplate; pDocTemplate = new CSingleDocTemplate( IDR_MAINFRAME, RUNTIME_CLASS(COpenHoldemDoc), RUNTIME_CLASS(CMainFrame), // main SDI frame window RUNTIME_CLASS(COpenHoldemView)); if (!pDocTemplate) return FALSE; AddDocTemplate(pDocTemplate); // Enable DDE Execute open if (load_from_registry) { EnableShellOpen(); RegisterShellFileTypes(false); } // Parse command line for standard shell commands, DDE, file open CCommandLineInfo cmdInfo; ParseCommandLine(cmdInfo); // Open the most recently saved file. (First on the MRU list.) Get the last // file from the registry. We need not account for cmdInfo.m_bRunAutomated and // cmdInfo.m_bRunEmbedded as they are processed before we get here. if (cmdInfo.m_nShellCommand == CCommandLineInfo::FileNew) { CString sLastPath(GetProfileString(_afxFileSection, "File1")); if (! sLastPath.IsEmpty()) { CFile f; // If file is there, set to open! if (f.Open(sLastPath, CFile::modeRead | CFile::shareDenyWrite)) { cmdInfo.m_nShellCommand = CCommandLineInfo::FileOpen; cmdInfo.m_strFileName = sLastPath; f.Close(); } } } // Dispatch commands specified on the command line. Will return FALSE if // app was launched with /RegServer, /Register, /Unregserver or /Unregister. if (!ProcessShellCommand(cmdInfo)) return FALSE; if (prefs.simple_window_title()) m_pMainWnd->PostMessage(WMA_SETWINDOWTEXT, 0, (LPARAM)NULL); // The one and only window has been initialized, so show and update it if (prefs.gui_start_minimized()) { m_pMainWnd->ShowWindow(SW_MINIMIZE); } else { m_pMainWnd->ShowWindow(SW_SHOW); } m_pMainWnd->UpdateWindow(); // call DragAcceptFiles only if there's a suffix // In an SDI app, this should occur after ProcessShellCommand // Enable drag/drop open m_pMainWnd->DragAcceptFiles(); // Bring main window to front m_pMainWnd->SetWindowPos(&CWnd::wndTop, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); m_pMainWnd->SetActiveWindow(); m_pMainWnd->SetFocus(); m_pMainWnd->SetForegroundWindow(); // autoconnect on start, if preferred if (prefs.autoconnector_when_to_connect() == k_AutoConnector_Connect_Once) { p_autoconnector->Connect(NULL); } // Start thread anyway; permanent connection might be enabled later via preferences. p_autoconnectorthread->StartThread(); return TRUE; }
CStitchCamDlg::CStitchCamDlg(CWnd* pParent /*=NULL*/) : CDialogEx(CStitchCamDlg::IDD, pParent) { m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); }
void CMainFrame::OnClose() { static_cast<CHbgMainApp*>(AfxGetApp())->HbgGetEngine()->Finalize(); CFrameWndEx::OnClose(); }
void CMainFrame::OnUpdateConnected(CCmdUI *pCmdUI) { pCmdUI->Enable(static_cast<CHbgMainApp*>(AfxGetApp())->HbgGetEngine()->Running()); }
LONG WINAPI CMiniDump::UnhandledExceptionFilter(_EXCEPTION_POINTERS* lpTopLevelExceptionFilter) { LONG retval = EXCEPTION_CONTINUE_SEARCH; BOOL bDumpCreated = FALSE; HMODULE hDll = nullptr; TCHAR szResult[800]; szResult[0] = _T('\0'); CPath dumpPath; #if ENABLE_MINIDUMP hDll = ::LoadLibrary(_T("dbghelp.dll")); if (hDll != nullptr) { MINIDUMPWRITEDUMP pMiniDumpWriteDump = (MINIDUMPWRITEDUMP)::GetProcAddress(hDll, "MiniDumpWriteDump"); if (pMiniDumpWriteDump != nullptr && AfxGetMyApp()->GetAppSavePath(dumpPath)) { // Check that the folder actually exists if (!FileExists(dumpPath)) { VERIFY(CreateDirectory(dumpPath, nullptr)); } CString strDumpName = AfxGetApp()->m_pszExeName; strDumpName.Append(_T(".exe.") + VersionInfo::GetVersionString() + _T(".dmp")); dumpPath.Append(strDumpName); // create the file HANDLE hFile = ::CreateFile(dumpPath, GENERIC_WRITE, FILE_SHARE_WRITE, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr); if (hFile != INVALID_HANDLE_VALUE) { _MINIDUMP_EXCEPTION_INFORMATION ExInfo; ExInfo.ThreadId = ::GetCurrentThreadId(); ExInfo.ExceptionPointers = lpTopLevelExceptionFilter; ExInfo.ClientPointers = FALSE; // write the dump bDumpCreated = pMiniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(), hFile, MiniDumpNormal, &ExInfo, nullptr, nullptr); if (bDumpCreated) { _stprintf_s(szResult, _countof(szResult), ResStr(IDS_MPC_CRASH), dumpPath); retval = EXCEPTION_EXECUTE_HANDLER; } else { _stprintf_s(szResult, _countof(szResult), ResStr(IDS_MPC_MINIDUMP_FAIL), dumpPath, GetLastError()); } ::CloseHandle(hFile); } else { _stprintf_s(szResult, _countof(szResult), ResStr(IDS_MPC_MINIDUMP_FAIL), dumpPath, GetLastError()); } } FreeLibrary(hDll); } if (szResult[0]) { switch (MessageBox(nullptr, szResult, _T("MPC-HC - Mini Dump"), bDumpCreated ? MB_YESNO : MB_OK)) { case IDYES: ShellExecute(nullptr, _T("open"), BUGS_URL, nullptr, nullptr, SW_SHOWDEFAULT); ExploreToFile(dumpPath); break; case IDNO: retval = EXCEPTION_CONTINUE_SEARCH; // rethrow the exception to make easier attaching a debugger break; } } #else if (MessageBox(nullptr, ResStr(IDS_MPC_BUG_REPORT), ResStr(IDS_MPC_BUG_REPORT_TITLE), MB_YESNO) == IDYES) { ShellExecute(nullptr, _T("open"), DOWNLOAD_URL, nullptr, nullptr, SW_SHOWDEFAULT); } #endif // DISABLE_MINIDUMP return retval; }
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CFrameWnd::OnCreate(lpCreateStruct) == -1) return -1; SetIcon(m_hIcon, TRUE); // 设置大图标 SetIcon(m_hIcon, FALSE); // 设置小图标 ///工具栏创建 m_imageList.Create(16,16,ILC_COLOR32|ILC_MASK,0,0); m_imageList.Add(AfxGetApp()->LoadIcon(IDI_ICON_LEFT));//0 m_imageList.Add(AfxGetApp()->LoadIcon(IDI_ICON_MIDDLE));//1 m_imageList.Add(AfxGetApp()->LoadIcon(IDI_ICON_RIGHT));//2 m_imageList.Add(AfxGetApp()->LoadIcon(IDI_ICON_TOP));//6 m_imageList.Add(AfxGetApp()->LoadIcon(IDI_ICON_BOTTOM));//7 m_imageList.Add(AfxGetApp()->LoadIcon(IDI_ICON_WIDTH));//3 m_imageList.Add(AfxGetApp()->LoadIcon(IDI_ICON_HEIGHT));//4 m_imageList.Add(AfxGetApp()->LoadIcon(IDI_ICON_SAMESIZE));//5 m_imageList.Add(AfxGetApp()->LoadIcon(IDI_ICON_HORI));//8 m_imageList.Add(AfxGetApp()->LoadIcon(IDI_ICON_VERI));//9 UINT btnIDs[12]; btnIDs[0]=IDI_ICON_LEFT; btnIDs[1]=IDI_ICON_MIDDLE; btnIDs[2]=IDI_ICON_RIGHT; btnIDs[3]=IDI_ICON_TOP; btnIDs[4]=IDI_ICON_BOTTOM; btnIDs[5]=ID_SEPARATOR; btnIDs[6]=IDI_ICON_WIDTH; btnIDs[7]=IDI_ICON_HEIGHT; btnIDs[8]=IDI_ICON_SAMESIZE; btnIDs[9]=ID_SEPARATOR; btnIDs[10]=IDI_ICON_HORI; btnIDs[11]=IDI_ICON_VERI; m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_NOALIGN | CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC); m_wndToolBar.SetButtons(btnIDs,12); m_wndToolBar.SetButtonText(0,toolLeftText); m_wndToolBar.SetButtonText(1,toolMiddleText); m_wndToolBar.SetButtonText(2,toolRightText); m_wndToolBar.SetButtonText(3,toolTopText); m_wndToolBar.SetButtonText(4,toolBottomText); m_wndToolBar.SetButtonText(6,toolWidthText); m_wndToolBar.SetButtonText(7,toolHeightText); m_wndToolBar.SetButtonText(8,toolSameSizeText); m_wndToolBar.SetButtonText(10,toolHorText); m_wndToolBar.SetButtonText(11,toolVerText); m_wndToolBar.GetToolBarCtrl().SetExtendedStyle(TBSTYLE_EX_DRAWDDARROWS); /* TBMETRICS tbmer; tbmer.cbSize=sizeof(TBMETRICS); tbmer.dwMask=TBMF_BUTTONSPACING; tbmer.cxButtonSpacing=5;//设置间隔 m_wndToolBar.GetToolBarCtrl().SetMetrics(&tbmer); */ m_wndToolBar.GetToolBarCtrl().SetImageList(&m_imageList); CRect temp; m_wndToolBar.GetItemRect(0,&temp); m_wndToolBar.SetSizes(CSize(temp.Width(),temp.Height()),CSize(16,16)); //Make the toolbar dockable m_wndToolBar.EnableDocking(CBRS_ALIGN_TOP); EnableDocking(CBRS_ALIGN_TOP); DockControlBar(&m_wndToolBar); ////////////////////////////去掉默认菜单栏 SetMenu(NULL); DestroyMenu(m_hMenuDefault); /////////////////////////// LONG style=::GetWindowLong(this->m_hWnd,GWL_STYLE);//取消标题栏 style &= ~WS_CAPTION; SetWindowLong(m_hWnd,GWL_STYLE,style); // GetWindowPlacement(&m_oldWindowPlaceMent); // FullScreen(); /////////////////////////////////////// theApp.ReadLogicVariablesFromFile(); SetTimer(AUTOSHUTDOWN,1000,NULL); /////////////////////// DeleteLogFile(); ////////////////////// AddTrayIcon(); /////////////// return 0; }
void CZSingleton::RemoveDrop() { CString gg(AfxGetApp()->m_pszExeName); ::RemoveProp(AfxGetApp()->GetMainWnd()->GetSafeHwnd(),gg); gg.Empty(); }
CIPNotFound::CIPNotFound(CWnd* pParent /*=NULL*/) : CDialogEx(CIPNotFound::IDD, pParent) { m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); }
void CMainFrame::OnFileCloseAll() { // TODO: 在此添加命令处理程序代码 AfxGetApp()->CloseAllDocuments(TRUE); }
static void PrintPiecesThread(void* pv) { CFrameWndEx* pFrame = (CFrameWndEx*)pv; CView* pView = pFrame->GetActiveView(); CPrintDialog PD(FALSE, PD_ALLPAGES|PD_USEDEVMODECOPIES|PD_NOPAGENUMS|PD_NOSELECTION, pFrame); if (theApp.DoPrintDialog(&PD) != IDOK) return; if (PD.m_pd.hDC == NULL) return; Project* project = lcGetActiveProject(); ObjArray<lcPiecesUsedEntry> PiecesUsed; project->GetPiecesUsed(PiecesUsed); PiecesUsed.Sort(PiecesUsedSortFunc, NULL); // gather file to print to if print-to-file selected CString strOutput; if (PD.m_pd.Flags & PD_PRINTTOFILE) { CString strDef(MAKEINTRESOURCE(AFX_IDS_PRINTDEFAULTEXT)); CString strPrintDef(MAKEINTRESOURCE(AFX_IDS_PRINTDEFAULT)); CString strFilter(MAKEINTRESOURCE(AFX_IDS_PRINTFILTER)); CString strCaption(MAKEINTRESOURCE(AFX_IDS_PRINTCAPTION)); CFileDialog dlg(FALSE, strDef, strPrintDef,OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, strFilter); dlg.m_ofn.lpstrTitle = strCaption; if (dlg.DoModal() != IDOK) return; strOutput = dlg.GetPathName(); } CString DocName; char* Ext = strrchr(project->m_strTitle, '.'); DocName.Format("LeoCAD - %.*s BOM", Ext ? Ext - project->m_strTitle : strlen(project->m_strTitle), project->m_strTitle); DOCINFO docInfo; memset(&docInfo, 0, sizeof(DOCINFO)); docInfo.cbSize = sizeof(DOCINFO); docInfo.lpszDocName = DocName; CString strPortName; int nFormatID; if (strOutput.IsEmpty()) { docInfo.lpszOutput = NULL; strPortName = PD.GetPortName(); nFormatID = AFX_IDS_PRINTONPORT; } else { docInfo.lpszOutput = strOutput; AfxGetFileTitle(strOutput, strPortName.GetBuffer(_MAX_PATH), _MAX_PATH); nFormatID = AFX_IDS_PRINTTOFILE; } SetAbortProc(PD.m_pd.hDC, _AfxAbortProc); pFrame->EnableWindow(FALSE); CPrintingDialog dlgPrintStatus(NULL); CString strTemp; dlgPrintStatus.SetDlgItemText(AFX_IDC_PRINT_DOCNAME, DocName); dlgPrintStatus.SetDlgItemText(AFX_IDC_PRINT_PRINTERNAME, PD.GetDeviceName()); AfxFormatString1(strTemp, nFormatID, strPortName); dlgPrintStatus.SetDlgItemText(AFX_IDC_PRINT_PORTNAME, strTemp); dlgPrintStatus.ShowWindow(SW_SHOW); dlgPrintStatus.UpdateWindow(); if (StartDoc(PD.m_pd.hDC, &docInfo) == SP_ERROR) { pFrame->EnableWindow(TRUE); dlgPrintStatus.DestroyWindow(); AfxMessageBox(AFX_IDP_FAILED_TO_START_PRINT); return; } int ResX = GetDeviceCaps(PD.m_pd.hDC, LOGPIXELSX); int ResY = GetDeviceCaps(PD.m_pd.hDC, LOGPIXELSY); CRect RectDraw(0, 0, GetDeviceCaps(PD.m_pd.hDC, HORZRES), GetDeviceCaps(PD.m_pd.hDC, VERTRES)); DPtoLP(PD.m_pd.hDC, (LPPOINT)(RECT*)&RectDraw, 2); RectDraw.DeflateRect((int)(ResX*(float)theApp.GetProfileInt("Default","Margin Left", 50)/100.0f), (int)(ResY*(float)theApp.GetProfileInt("Default","Margin Top", 50)/100.0f), (int)(ResX*(float)theApp.GetProfileInt("Default","Margin Right", 50)/100.0f), (int)(ResY*(float)theApp.GetProfileInt("Default","Margin Bottom", 50)/100.0f)); CRect HeaderRect = RectDraw; HeaderRect.top -= (int)(ResY*theApp.GetProfileInt("Default", "Margin Top", 50) / 200.0f); HeaderRect.bottom += (int)(ResY*theApp.GetProfileInt("Default", "Margin Bottom", 50) / 200.0f); int RowsPerPage = AfxGetApp()->GetProfileInt("Default", "Catalog Rows", 10); int ColsPerPage = AfxGetApp()->GetProfileInt("Default", "Catalog Columns", 3); int PicHeight = RectDraw.Height() / RowsPerPage; int PicWidth = RectDraw.Width() / ColsPerPage; int TotalRows = (PiecesUsed.GetSize() + ColsPerPage - 1) / ColsPerPage; int TotalPages = (TotalRows + RowsPerPage - 1) / RowsPerPage; int RowHeight = RectDraw.Height() / RowsPerPage; int ColWidth = RectDraw.Width() / ColsPerPage; PD.m_pd.nMinPage = 1; PD.m_pd.nMaxPage = TotalPages + 1; UINT EndPage = PD.m_pd.nToPage; UINT StartPage = PD.m_pd.nFromPage; if (PD.PrintAll()) { EndPage = PD.m_pd.nMaxPage; StartPage = PD.m_pd.nMinPage; } lcClamp(EndPage, PD.m_pd.nMinPage, PD.m_pd.nMaxPage); lcClamp(StartPage, PD.m_pd.nMinPage, PD.m_pd.nMaxPage); int StepPage = (EndPage >= StartPage) ? 1 : -1; VERIFY(strTemp.LoadString(AFX_IDS_PRINTPAGENUM)); // begin page printing loop BOOL bError = FALSE; // Creating Compatible Memory Device Context CDC *pMemDC = new CDC; if (!pMemDC->CreateCompatibleDC(pView->GetDC())) return; BITMAPINFO bi; ZeroMemory(&bi, sizeof(BITMAPINFO)); bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); bi.bmiHeader.biWidth = PicWidth; bi.bmiHeader.biHeight = PicHeight; bi.bmiHeader.biPlanes = 1; bi.bmiHeader.biBitCount = 24; bi.bmiHeader.biCompression = BI_RGB; bi.bmiHeader.biSizeImage = PicWidth * PicHeight * 3; bi.bmiHeader.biXPelsPerMeter = 2925; bi.bmiHeader.biYPelsPerMeter = 2925; bi.bmiHeader.biClrUsed = 0; bi.bmiHeader.biClrImportant = 0; LPBITMAPINFOHEADER lpbi[1]; HBITMAP hBm, hBmOld; hBm = CreateDIBSection(pView->GetDC()->GetSafeHdc(), &bi, DIB_RGB_COLORS, (void **)&lpbi, NULL, (DWORD)0); if (!hBm) return; hBmOld = (HBITMAP)::SelectObject(pMemDC->GetSafeHdc(), hBm); PIXELFORMATDESCRIPTOR pfd = { sizeof(PIXELFORMATDESCRIPTOR), 1, PFD_DRAW_TO_BITMAP | PFD_SUPPORT_OPENGL | PFD_SUPPORT_GDI, PFD_TYPE_RGBA, 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, PFD_MAIN_PLANE, 0, 0, 0, 0 }; int pixelformat = ChoosePixelFormat(pMemDC->m_hDC, &pfd); DescribePixelFormat(pMemDC->m_hDC, pixelformat, sizeof(PIXELFORMATDESCRIPTOR), &pfd); SetPixelFormat(pMemDC->m_hDC, pixelformat, &pfd); HGLRC hmemrc = wglCreateContext(pMemDC->GetSafeHdc()); wglMakeCurrent(pMemDC->GetSafeHdc(), hmemrc); GL_DisableVertexBufferObject(); float Aspect = (float)PicWidth/(float)PicHeight; glViewport(0, 0, PicWidth, PicHeight); glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LEQUAL); glEnable(GL_POLYGON_OFFSET_FILL); glPolygonOffset(0.5f, 0.1f); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glClearColor(1, 1, 1, 1); LOGFONT lf; memset(&lf, 0, sizeof(LOGFONT)); lf.lfHeight = -MulDiv(12, ResY, 72); lf.lfWeight = FW_REGULAR; lf.lfCharSet = DEFAULT_CHARSET; lf.lfQuality = PROOF_QUALITY; strcpy (lf.lfFaceName , "Arial"); HFONT HeaderFont = CreateFontIndirect(&lf); HFONT OldFont = (HFONT)SelectObject(PD.m_pd.hDC, HeaderFont); SetBkMode(PD.m_pd.hDC, TRANSPARENT); SetTextColor(PD.m_pd.hDC, 0x000000); SetTextAlign(PD.m_pd.hDC, TA_CENTER|TA_NOUPDATECP); DWORD PrintOptions = AfxGetApp()->GetProfileInt("Settings", "Print", PRINT_NUMBERS | PRINT_BORDER/*|PRINT_NAMES*/); bool DrawNames = 1;//(PrintOptions & PRINT_NAMES) != 0; bool Horizontal = 1;//(PrintOptions & PRINT_HORIZONTAL) != 0; pMemDC->SetTextColor(0x000000); pMemDC->SetBkMode(TRANSPARENT); // lf.lfHeight = -MulDiv(40, GetDeviceCaps(pMemDC->m_hDC, LOGPIXELSY), 72); // lf.lfWeight = FW_BOLD; HFONT CatalogFont = CreateFontIndirect(&lf); lf.lfHeight = -MulDiv(80, GetDeviceCaps(pMemDC->m_hDC, LOGPIXELSY), 72); HFONT CountFont = CreateFontIndirect(&lf); HFONT OldMemFont = (HFONT)SelectObject(pMemDC->m_hDC, CatalogFont); HPEN hpOld = (HPEN)SelectObject(pMemDC->m_hDC, GetStockObject(BLACK_PEN)); for (UINT CurPage = StartPage; CurPage != EndPage; CurPage += StepPage) { TCHAR szBuf[80]; wsprintf(szBuf, strTemp, CurPage); dlgPrintStatus.SetDlgItemText(AFX_IDC_PRINT_PAGENUM, szBuf); if (::StartPage(PD.m_pd.hDC) < 0) { bError = TRUE; break; } // Draw header and footer. SelectObject(PD.m_pd.hDC, HeaderFont); CString Header; UINT Align; FormatHeader(Header, Align, AfxGetApp()->GetProfileString("Default", "Catalog Header", ""), project->m_strTitle, project->m_strAuthor, project->m_strDescription, CurPage, TotalPages); Align |= DT_TOP|DT_SINGLELINE; DrawText(PD.m_pd.hDC, (LPCTSTR)Header, Header.GetLength(), HeaderRect, Align); FormatHeader(Header, Align, AfxGetApp()->GetProfileString("Default", "Catalog Footer", "Page &P"), project->m_strTitle, project->m_strAuthor, project->m_strDescription, CurPage, TotalPages); Align |= DT_BOTTOM|DT_SINGLELINE; DrawText(PD.m_pd.hDC, (LPCTSTR)Header, Header.GetLength(), HeaderRect, Align); int StartPiece = (CurPage - 1) * RowsPerPage * ColsPerPage; int EndPiece = lcMin(StartPiece + RowsPerPage * ColsPerPage, PiecesUsed.GetSize()); for (int CurPiece = StartPiece; CurPiece < EndPiece; CurPiece++) { FillRect(pMemDC->m_hDC, CRect(0, PicHeight, PicWidth, 0), (HBRUSH)GetStockObject(WHITE_BRUSH)); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); PieceInfo* pInfo = PiecesUsed[CurPiece].Info; pInfo->ZoomExtents(30.0f, Aspect); pInfo->RenderPiece(PiecesUsed[CurPiece].ColorIndex); glFinish(); // Draw description text at the bottom. CRect TextRect(0, 0, PicWidth, PicHeight); if (DrawNames) { SelectObject(pMemDC->m_hDC, CatalogFont); pMemDC->DrawText(pInfo->m_strDescription, strlen(pInfo->m_strDescription), TextRect, DT_CALCRECT | DT_WORDBREAK); TextRect.OffsetRect(0, PicHeight - TextRect.Height() - 5); pMemDC->DrawText(pInfo->m_strDescription, strlen(pInfo->m_strDescription), TextRect, DT_WORDBREAK); } // Draw count. SelectObject(pMemDC->m_hDC, CountFont); TextRect = CRect(0, 0, PicWidth, TextRect.top); TextRect.DeflateRect(5, 5); char CountStr[16]; sprintf(CountStr, "%dx", PiecesUsed[CurPiece].Count); pMemDC->DrawText(CountStr, strlen(CountStr), TextRect, DT_BOTTOM | DT_LEFT | DT_SINGLELINE); LPBITMAPINFOHEADER lpbi[1]; lpbi[0] = (LPBITMAPINFOHEADER)GlobalLock(MakeDib(hBm, 24)); BITMAPINFO bi; ZeroMemory(&bi, sizeof(BITMAPINFO)); memcpy (&bi.bmiHeader, lpbi[0], sizeof(BITMAPINFOHEADER)); SetStretchBltMode(PD.m_pd.hDC, COLORONCOLOR); int CurRow, CurCol; if (Horizontal) { CurRow = (CurPiece - StartPiece) / ColsPerPage; CurCol = (CurPiece - StartPiece) % ColsPerPage; } else { CurRow = (CurPiece - StartPiece) % RowsPerPage; CurCol = (CurPiece - StartPiece) / RowsPerPage; } int Left = RectDraw.left + ColWidth * CurCol + (ColWidth - PicWidth) / 2; int Top = RectDraw.top + RowHeight * CurRow + (RowHeight - PicHeight) / 2; StretchDIBits(PD.m_pd.hDC, Left, Top, PicWidth, PicHeight, 0, 0, PicWidth, PicHeight, (LPBYTE)lpbi[0] + lpbi[0]->biSize + lpbi[0]->biClrUsed * sizeof(RGBQUAD), &bi, DIB_RGB_COLORS, SRCCOPY); if (lpbi[0]) GlobalFreePtr(lpbi[0]); } if (::EndPage(PD.m_pd.hDC) < 0 || !_AfxAbortProc(PD.m_pd.hDC, 0)) { bError = TRUE; break; } } SelectObject(pMemDC->m_hDC, hpOld); SelectObject(PD.m_pd.hDC, OldFont); DeleteObject(HeaderFont); SelectObject(pMemDC->m_hDC, OldMemFont); DeleteObject(CatalogFont); DeleteObject(CountFont); GL_EnableVertexBufferObject(); wglMakeCurrent(NULL, NULL); wglDeleteContext(hmemrc); SelectObject(pMemDC->GetSafeHdc(), hBmOld); DeleteObject(hBm); delete pMemDC; if (!bError) EndDoc(PD.m_pd.hDC); else AbortDoc(PD.m_pd.hDC); pFrame->EnableWindow(); dlgPrintStatus.DestroyWindow(); if (PD.m_pd.hDC != NULL) { ::DeleteDC(PD.m_pd.hDC); PD.m_pd.hDC = NULL; } }
void CMainFrame::OnFileSaveAll() { // TODO: 在此添加命令处理程序代码 AfxGetApp()->SaveAllModified(); g_pFileView->SaveProject(); }
BOOL CSystemTray::SetIcon(LPCTSTR lpszIconName) { HICON hIcon = AfxGetApp()->LoadIcon(lpszIconName); return SetIcon(hIcon); }
void CTipDlg::OnPaint() { CPaintDC dc(this); // device context for painting // Get paint area for the big static control // CWnd* pStatic = GetDlgItem(IDC_BULB); CWnd* pFrame = GetDlgItem( IDC_TIPFRAME ); CRect rect; // pStatic->GetWindowRect(&rect); pFrame->GetWindowRect( &rect ); ScreenToClient(&rect); // Paint the background white. CBrush brush; brush.CreateStockObject(WHITE_BRUSH); dc.FillRect(rect, &brush); // Load bitmap and get dimensions of the bitmap CBitmap bmp; bmp.LoadBitmap(IDB_LIGHTBULB); BITMAP bmpInfo; bmp.GetBitmap(&bmpInfo); // Draw the dark gray band on the side CRect left; CopyRect( left, rect ); left.right = bmpInfo.bmWidth + 30; brush.CreateStockObject(LTGRAY_BRUSH); dc.FillRect(left, &brush); // Draw bitmap in top corner and validate only top portion of window // CDC dcTmp; // dcTmp.CreateCompatibleDC(&dc); // dcTmp.SelectObject(&bmp); rect.bottom = bmpInfo.bmHeight + rect.top; HICON hIcon = AfxGetApp()->LoadIcon( IDI_LIGHTBULB ); if ( hIcon != NULL ) DrawIconEx( dc.GetSafeHdc(), rect.left + 10, rect.top + 10, hIcon, 0, 0, NULL, NULL, DI_NORMAL ); // dc.BitBlt(rect.left, rect.top, rect.Width(), rect.Height(), // &dcTmp, 0, 0, SRCCOPY); int mode = dc.GetBkMode(); dc.SetBkMode( TRANSPARENT ); // Draw out "Did you know..." message next to the bitmap CString strMessage; strMessage.LoadString(CG_IDS_DIDYOUKNOW); rect.left += bmpInfo.bmWidth + 20; COLORREF old = dc.SetTextColor( RGB( 200, 200, 200 ) ); OffsetRect( &rect, 2, 2 ); dc.DrawText(strMessage, rect, DT_VCENTER | DT_SINGLELINE); dc.SetTextColor( RGB( 0, 0, 255 ) ); OffsetRect( &rect, -2, -2 ); dc.DrawText(strMessage, rect, DT_VCENTER | DT_SINGLELINE); dc.SetTextColor( old ); dc.SetBkMode( mode ); // Do not call CDialog::OnPaint() for painting messages }
CMpcAudioRenderer::CMpcAudioRenderer(LPUNKNOWN punk, HRESULT* phr) : CBaseRenderer(__uuidof(this), MpcAudioRendererName, punk, phr) , m_pDSBuffer(NULL) , m_pSoundTouch(NULL) , m_pDS(NULL) , m_dwDSWriteOff(0) , m_nDSBufSize(0) , m_dRate(1.0) , m_pReferenceClock(NULL) , m_pWaveFileFormat(NULL) , pMMDevice(NULL) , pAudioClient(NULL) , pRenderClient(NULL) , m_useWASAPI(true) , m_bMuteFastForward(false) , m_csSound_Device(_T("")) , nFramesInBuffer(0) , hnsPeriod(0) , hTask(NULL) , bufferSize(0) , isAudioClientStarted(false) , lastBufferTime(0) , hnsActualDuration(0) , m_lVolume(DSBVOLUME_MIN) { HMODULE hLib; #ifdef STANDALONE_FILTER CRegKey key; ULONG len; if (ERROR_SUCCESS == key.Open(HKEY_CURRENT_USER, _T("Software\\Gabest\\Filters\\MPC Audio Renderer"), KEY_READ)) { DWORD dw; TCHAR buff[256]; if (ERROR_SUCCESS == key.QueryDWORDValue(_T("UseWasapi"), dw)) { m_useWASAPI = !!dw; } if (ERROR_SUCCESS == key.QueryDWORDValue(_T("MuteFastForward"), dw)) { m_bMuteFastForward = !!dw; } len = _countof(buff); memset(buff, 0, sizeof(buff)); if (ERROR_SUCCESS == key.QueryStringValue(_T("SoundDevice"), buff, &len)) { m_csSound_Device = CString(buff); } } #else m_useWASAPI = !!AfxGetApp()->GetProfileInt(_T("Filters\\MPC Audio Renderer"), _T("UseWasapi"), m_useWASAPI); m_bMuteFastForward = !!AfxGetApp()->GetProfileInt(_T("Filters\\MPC Audio Renderer"), _T("MuteFastForward"), m_bMuteFastForward); m_csSound_Device = AfxGetApp()->GetProfileString(_T("Filters\\MPC Audio Renderer"), _T("SoundDevice"), _T("")); #endif m_useWASAPIAfterRestart = m_useWASAPI; // Load Vista specific DLLs hLib = LoadLibrary(L"avrt.dll"); if (hLib != NULL) { pfAvSetMmThreadCharacteristicsW = (PTR_AvSetMmThreadCharacteristicsW) GetProcAddress(hLib, "AvSetMmThreadCharacteristicsW"); pfAvRevertMmThreadCharacteristics = (PTR_AvRevertMmThreadCharacteristics) GetProcAddress(hLib, "AvRevertMmThreadCharacteristics"); } else { m_useWASAPI = false; // Wasapi not available below Vista } TRACE(_T("CMpcAudioRenderer constructor\n")); if (!m_useWASAPI) { DirectSoundEnumerate((LPDSENUMCALLBACK)DSEnumProc2, (VOID*)&m_csSound_Device); m_pSoundTouch = DEBUG_NEW soundtouch::SoundTouch(); *phr = DirectSoundCreate8(&lpSoundGUID, &m_pDS, NULL); } }
CTipDlg::CTipDlg(CWnd* pParent /*=NULL*/) : CDialog(IDD_TIP, pParent) { //{{AFX_DATA_INIT(CTipDlg) m_bStartup = TRUE; //}}AFX_DATA_INIT // We need to find out what the startup and file position parameters are // If startup does not exist, we assume that the Tips on startup is checked TRUE. CWinApp* pApp = AfxGetApp(); m_bStartup = !pApp->GetProfileInt(szSection, szIntStartup, 0); m_dwTipPos = (DWORD)pApp->GetProfileInt(szSection, szIntFilePos, 0); // Load the license if ( CWinFile::LoadResource( MAKEINTRESOURCE( IDR_TIPS ), NULL, &m_dwSize, "BUFFER", NULL ) && m_dwSize > 0 ) { if ( m_sTips.allocate( m_dwSize + 1 ) ) if ( !CWinFile::LoadResource( MAKEINTRESOURCE( IDR_TIPS ), (LPBYTE)m_sTips.ptr(), &m_dwSize, "BUFFER", NULL ) ) m_sTips.destroy(); } // end if // Ensure we are not overflowing the tip buffer if ( m_dwTipPos >= m_dwSize ) m_dwTipPos = 0; /* // Now try to open the tips file m_pStream = fopen("tips.txt", "r"); if (m_pStream == NULL) { m_strTip.LoadString(CG_IDS_FILE_ABSENT); return; } // If the timestamp in the INI file is different from the timestamp of // the tips file, then we know that the tips file has been modified // Reset the file position to 0 and write the latest timestamp to the // ini file struct _stat buf; _fstat(_fileno(m_pStream), &buf); CString strCurrentTime = ctime(&buf.st_ctime); strCurrentTime.TrimRight(); CString strStoredTime = pApp->GetProfileString(szSection, szTimeStamp, NULL); if (strCurrentTime != strStoredTime) { iFilePos = 0; pApp->WriteProfileString(szSection, szTimeStamp, strCurrentTime); } if (fseek(m_pStream, iFilePos, SEEK_SET) != 0) { AfxMessageBox(CG_IDP_FILE_CORRUPT); } else { GetNextTipString(m_strTip); } */ }
void COptionsDialog::OnOK() { if (!UpdateData(TRUE)) { TRACE0("UpdateData failed during dialog termination.\n"); // the UpdateData routine will set focus to correct item return; } CGeneralManager * m = ((CReportAsistentApp *) AfxGetApp())->m_pGeneralManager; CString Pom; int iPom; CUT_Hint oHint; CReportAsistentApp * App = ((CReportAsistentApp *) AfxGetApp()); //dedek: WordTemplate m->WordManager.setWordTemplate(m_strWordTemplate); //Get Language radio buttons if (GetCheckedRadioButton(IDC_CZECH_RADIO, IDC_ENGLISH_RADIO) == IDC_ENGLISH_RADIO) m->setLanguage("en"); else m->setLanguage("cz"); //Get Tree Items //Height Edit m_HeightEdit.GetWindowText(Pom); iPom = StrToInt((LPCTSTR)Pom); if ((iPom > 15) && (iPom<= 50)) App->m_iTreeItemHeight = iPom; //Indent Edit m_IndentEdit.GetWindowText(Pom); iPom =StrToInt((LPCTSTR)Pom); if ((iPom > 15) && (iPom<= 50)) App->m_iTreeItemIndent = iPom; App->m_bTreeHasLines = m_LinesCheckBox.GetCheck(); App->m_bIdInItemName = m_IdInTreeCheckBox.GetCheck(); App->m_bTreeHasButtons = m_ButtonsCheckBox.GetCheck(); //Name Length Edit m_NameLengthEdit.GetWindowText(Pom); iPom =StrToInt((LPCTSTR)Pom); if ((iPom > 5) && (iPom<= 999)) App->m_iTreeItemNameLength = iPom; //TextEdit size Edit m_TextEditSize.GetWindowText(Pom); iPom =StrToInt((LPCTSTR)Pom); if ((iPom > 80) && (iPom<= 300)) App->m_iTextEditSize = iPom; //Get orphans radio buttons: CString OrphSol = App->FirstDocumentInFirstTemplate()->GetReportSettings("orphans_solution"); switch (GetCheckedRadioButton(IDC_IGNORE_RADIO, IDC_SET_DEFAULT_RADIO)) { case IDC_IGNORE_RADIO: App->FirstDocumentInFirstTemplate()->SetReportSettings("orphans_solution","ignore"); break; case IDC_DELETE_RADIO: App->FirstDocumentInFirstTemplate()->SetReportSettings("orphans_solution","delete"); break; case IDC_SET_DEFAULT_RADIO: App->FirstDocumentInFirstTemplate()->SetReportSettings("orphans_solution","set_default"); break; } //get mark orphans BOOL bChecked = App->m_bMarkOrphans; App->m_bMarkOrphans = m_MarkOrphansCheckBox.GetCheck(); if (bChecked ==App->m_bMarkOrphans) oHint.iMarkOrphans = 0; else if (bChecked == 0) oHint.iMarkOrphans = ORP_SIGN; else oHint.iMarkOrphans = ORP_UNSIGN; //dedek: jazyk App->FirstDocumentInFirstTemplate()->SetReportSettings("language", m->getLanguage()); //Apply changes App->FirstDocumentInFirstTemplate()->SetModifiedFlag(); App->FirstDocumentInFirstTemplate()->UpdateAllViews(NULL, UT_SETTINGS, &oHint); EndDialog(IDOK); }
COpenHoldemDoc * COpenHoldemDoc::GetDocument() { CFrameWnd * pFrame = (CFrameWnd *)(AfxGetApp()->m_pMainWnd); return (COpenHoldemDoc *) pFrame->GetActiveDocument(); }
CDebugShadersDlg::CDebugShadersDlg() : CModelessDialog(IDD) , m_timerOneTime(this, TIMER_ONETIME_START, TIMER_ONETIME_END - TIMER_ONETIME_START + 1) , m_Compiler(nullptr) { EventRouter::EventSelection receives; receives.insert(MpcEvent::SHADER_LIST_CHANGED); GetEventd().Connect(m_eventc, receives, std::bind(&CDebugShadersDlg::EventCallback, this, std::placeholders::_1)); // Set window icon VERIFY(SetIcon(AfxGetMainWnd()->GetIcon(true), true) == nullptr); // Setup window auto-resize and restore last position SetSizeGripVisibility(FALSE); SetMinTrackSize(CSize(360, 100)); AddAnchor(IDC_COMBO1, TOP_LEFT, TOP_RIGHT); AddAnchor((UINT)IDC_STATIC, TOP_LEFT, BOTTOM_RIGHT); AddAnchor(IDC_EDIT1, TOP_LEFT, BOTTOM_RIGHT); AddAnchor(IDC_RADIO1, TOP_RIGHT); AddAnchor(IDC_RADIO2, TOP_RIGHT); AddAnchor(IDC_RADIO3, TOP_RIGHT); AddAnchor(IDC_RADIO4, TOP_RIGHT); EnableSaveRestore(IDS_R_DEBUG_SHADERS); CWinApp* pApp = AfxGetApp(); // Restore controls' old state m_iVersion = pApp->GetProfileInt(IDS_R_DEBUG_SHADERS, IDS_RS_DEBUG_SHADERS_LASTVERSION, ps_2_0); VERIFY(UpdateData(FALSE)); CString oldpath = pApp->GetProfileString(IDS_R_DEBUG_SHADERS, IDS_RS_DEBUG_SHADERS_LASTFILE); if (!oldpath.IsEmpty()) { ASSERT(m_Shaders.GetCount() == 0); int sel = m_Shaders.AddString(oldpath); if (sel >= 0) { VERIFY(m_Shaders.SetCurSel(sel) != CB_ERR); } else { ASSERT(FALSE); } } // Put WM_PAINT message before WM_APP_RECOMPILE_SHADER UpdateWindow(); // Load new shader list OnListRefresh(); // We need to trigger shader compilation manually when // old state's selected shader is present in current shader list. // Otherwise it's triggered by OnListRefresh() int sel = m_Shaders.GetCurSel(); if (sel != CB_ERR) { CString path; m_Shaders.GetLBText(sel, path); ASSERT(!path.IsEmpty()); if (oldpath == path) { UpdateNotifierState(); VERIFY(PostMessage(WM_APP_RECOMPILE_SHADER)); } } // Display first-run dialog if (pApp->GetProfileInt(IDS_R_DEBUG_SHADERS, IDS_RS_DEBUG_SHADERS_FIRSTRUN, 1)) { CString msg; if (msg.LoadString(IDS_DEBUGSHADERS_FIRSTRUN_MSG)) { AfxMessageBox(msg, MB_ICONINFORMATION); } else { ASSERT(FALSE); } VERIFY(pApp->WriteProfileInt(IDS_R_DEBUG_SHADERS, IDS_RS_DEBUG_SHADERS_FIRSTRUN, 0)); } }
CwowlauncherDlg::CwowlauncherDlg(CWnd* pParent /*=NULL*/) : CDHtmlDialog(CwowlauncherDlg::IDD, CwowlauncherDlg::IDH, pParent) { m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); }
void CTrayDialog::TraySetIcon(UINT nResourceID) { TraySetIcon(AfxGetApp()->LoadIcon(nResourceID)); }
BOOL CBetaPatchClientDlg::InitControls() { #ifdef __LANG_RUS enum PublisherVersion { PUBLISHER_VERSION_1 = 0, PUBLISHER_VERSION_2 = 1 }; PublisherVersion ePublisherVersion = PUBLISHER_VERSION_1; CScanner scanner; if( scanner.Load( "a.txt" ) == TRUE ) { int nKeyNumber = scanner.GetNumber(); if( nKeyNumber == 1 ) ePublisherVersion = PUBLISHER_VERSION_2; else ePublisherVersion = PUBLISHER_VERSION_1; } else ePublisherVersion = PUBLISHER_VERSION_1; #endif // __LANG_RUS #ifdef __LANG_RUS DWORD dwBitmapID = ( ePublisherVersion == PUBLISHER_VERSION_1 ) ? IDC_BITMAP_MAIN : IDC_BITMAP_MAIN_2; if( m_pic.Load( dwBitmapID ) ) #else // __LANG_RUS if( m_pic.Load( IDC_BITMAP_MAIN ) ) #endif // __LANG_RUS { CSize size = m_pic.GetImageSize(); SetWindowPos( NULL, 0, 0, size.cx, size.cy, SWP_NOZORDER | SWP_NOMOVE ); HRGN hRgn = CreateRoundRectRgn( 0, 0, size.cx, size.cy, 20, 20 ); if( hRgn ) ::SetWindowRgn( m_hWnd, hRgn, FALSE ); } int nInfoGap = 0; int nWeblinkGap = 0; #if defined(__LANG_JAP) #if 0 //JAPAN 패치 클라이언트 이미지 변경관련 삭제. nInfoGap = 5; nWeblinkGap = 35; srand( (unsigned)time( NULL ) ); int nsel = rand()%4; UINT nchrarry[4] = { IDB_BITMAP_CHAR1, IDB_BITMAP_CHAR3, IDB_BITMAP_CHAR5, IDB_BITMAP_CHAR7 }; UINT nchrarryM[4] = { IDB_BITMAP_CHAR2, IDB_BITMAP_CHAR4, IDB_BITMAP_CHAR6, IDB_BITMAP_CHAR8 }; m_bmpchr[0].LoadBitmap( nchrarry[nsel] ); m_bmpchr[1].LoadBitmap( nchrarryM[nsel] ); #endif #endif // __LANG_JAP m_Button_Exit.SetBitmaps(IDB_BITMAP_CLOSE00, RGB(255, 0, 255), IDB_BITMAP_CLOSE01, RGB(255, 0, 255) ); m_Button_Exit.SetAlign(CButtonST::ST_ALIGN_OVERLAP, FALSE); m_Button_Exit.SetPressedStyle(CButtonST::BTNST_PRESSED_LEFTRIGHT, FALSE); m_Button_Exit.SetColor(CButtonST::BTNST_COLOR_FG_IN, RGB(0, 0, 0)); m_Button_Exit.SetColor(CButtonST::BTNST_COLOR_FG_OUT, RGB(0, 0, 0)); m_Button_Exit.SizeToContent(); m_Button_Exit.DrawTransparent(TRUE); m_Button_Exit.DrawBorder(FALSE, FALSE); m_Button_Exit.SetBtnCursor(IDC_CURSOR1); m_Button_Option.SetBitmaps(IDB_BITMAP_OPTION00, RGB(255, 0, 255), IDB_BITMAP_OPTION01, RGB(255, 0, 255) ); m_Button_Option.SetAlign(CButtonST::ST_ALIGN_OVERLAP, FALSE); m_Button_Option.SetPressedStyle(CButtonST::BTNST_PRESSED_LEFTRIGHT, FALSE); m_Button_Option.SetColor(CButtonST::BTNST_COLOR_FG_IN, RGB(0, 0, 0)); m_Button_Option.SetColor(CButtonST::BTNST_COLOR_FG_OUT, RGB(0, 0, 0)); m_Button_Option.SizeToContent(); m_Button_Option.DrawTransparent(TRUE); m_Button_Option.DrawBorder(FALSE, FALSE); m_Button_Option.SetBtnCursor(IDC_CURSOR1); m_Button_Start.SetBitmaps(IDB_BITMAP_START00, RGB(255, 0, 255), IDB_BITMAP_START01, RGB(255, 0, 255) ); m_Button_Start.SetAlign(CButtonST::ST_ALIGN_OVERLAP, FALSE); m_Button_Start.SetPressedStyle(CButtonST::BTNST_PRESSED_LEFTRIGHT, FALSE); m_Button_Start.SetColor(CButtonST::BTNST_COLOR_FG_IN, RGB(0, 0, 0)); m_Button_Start.SetColor(CButtonST::BTNST_COLOR_FG_OUT, RGB(0, 0, 0)); m_Button_Start.SizeToContent(); m_Button_Start.DrawTransparent(TRUE); m_Button_Start.DrawBorder(FALSE, FALSE); m_Button_Start.SetBtnCursor(IDC_CURSOR1); m_Button_Register.SetBitmaps(IDB_BITMAP_REGISTER00, RGB(255, 0, 255), IDB_BITMAP_REGISTER01, RGB(255, 0, 255) ); m_Button_Register.SetAlign(CButtonST::ST_ALIGN_OVERLAP, FALSE); m_Button_Register.SetPressedStyle(CButtonST::BTNST_PRESSED_LEFTRIGHT, FALSE); m_Button_Register.SetColor(CButtonST::BTNST_COLOR_FG_IN, RGB(0, 0, 0)); m_Button_Register.SetColor(CButtonST::BTNST_COLOR_FG_OUT, RGB(0, 0, 0)); m_Button_Register.SizeToContent(); m_Button_Register.DrawTransparent(TRUE); m_Button_Register.DrawBorder(FALSE, FALSE); m_Button_Register.SetBtnCursor(IDC_CURSOR1); #if defined(__LANG_ENG_USA) || defined(__LANG_ENG_USATEST) || defined(__LANG_GER) || defined(__LANG_FRA) || defined(__LANG_POR) m_Button_Register.ShowWindow(SW_SHOW); #else m_Button_Register.ShowWindow(SW_HIDE); #endif // static //#if defined(__LANG_THAI) //Background Image 교체로 Font Color 변경 COLORREF cr = RGB( 0,0,0 ); m_Static_CurrentState.SetTextColor( cr ); m_Static_CurrentState.SetFontBold(true); m_Static_DownSpeed.SetTextColor( cr ); m_Static_FileNumber.SetTextColor( cr ); m_Static_MasqueradeVersion.SetTextColor( cr ); m_Static_MasqueradeVersion.SetFontBold(true); //#endif /*#if (__CURRENT_LANG == LANG_ENG || __CURRENT_LANG == LANG_GER || __CURRENT_LANG == LANG_FRA )//|| __CURRENT_CNTRY == CNTRY_TWN) #if __VER == 12 COLORREF cr = RGB( 255, 255, 255 ); m_Static_CurrentState.SetTextColor( cr ); m_Static_DownSpeed.SetTextColor( cr ); m_Static_FileNumber.SetTextColor( cr ); m_Static_MasqueradeVersion.SetTextColor( cr ); #endif #endif*/ #ifdef __HANGAME0307 // 한게임 대응 버젼 TCHAR* szText = HOME_LINK; TCHAR* szURL = HOME_LINK; TCHAR* szWebURL = WEB_FIRST_PAGE; if( AfxGetApp()->m_lpCmdLine[0] != '\0' && memcmp( AfxGetApp()->m_lpCmdLine, "hangame.co.jp", 13 ) == 0 ) { szText = "http://www.hangame.co.jp"; szURL = "http://www.hangame.co.jp/game.asp?fo"; szWebURL = "http://www.flyff.jp/in_client/info/list.asp?domain=hangame.co.jp"; } #else // 일반버젼 #ifdef __LANG_RUS TCHAR* szText = ( ePublisherVersion == PUBLISHER_VERSION_1 ) ? HOME_LINK : HOME_LINK_2; TCHAR* szURL = ( ePublisherVersion == PUBLISHER_VERSION_1 ) ? HOME_LINK : HOME_LINK_2; TCHAR* szWebURL = ( ePublisherVersion == PUBLISHER_VERSION_1 ) ? WEB_FIRST_PAGE : WEB_FIRST_PAGE_2; #else // __LANG_RUS TCHAR* szText = HOME_LINK; TCHAR* szURL = HOME_LINK; TCHAR* szWebURL = WEB_FIRST_PAGE; #endif // __LANG_RUS #endif // __HANGAME0307 #if __CURRENT_LANG == LANG_KOR #ifdef __LINK_PORTAL // 한국 : 엔젤, 버디 포탈 링크 연결 TCHAR szArg1[64] = {0, }; TCHAR szArg2[64] = {0, }; _stscanf( AfxGetApp()->m_lpCmdLine, "%s %s", szArg1, szArg2 ); // AfxMessageBox( AfxGetApp()->m_lpCmdLine ); CString strCmdLine; strCmdLine.Format("%s", szArg2); int nLength = strCmdLine.GetLength(); if(nLength > 4) { CString strCmpWord = strCmdLine.Mid(nLength-4, nLength); if(strCmpWord == "__an") { szText = "http://af.gameangel.com"; szURL = "http://af.gameangel.com"; } else if(strCmpWord == "__bu") { szText = "http://flyff.buddybuddy.co.kr"; szURL = "http://flyff.buddybuddy.co.kr"; } } #endif //__LINK_PORTAL #endif // LANG_KOR // 홈페이지 링크 m_Static_HomeLink.SetWindowText( szText ); /*#if __CURRENT_CNTRY == CNTRY_HK m_Static_HomeLink.SetWindowPos( NULL, 300, 22+nWeblinkGap, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOREDRAW ); #else*/ m_Static_HomeLink.SetWindowPos( NULL, 280, 242+nWeblinkGap, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOREDRAW ); //#endif #if __CURRENT_LANG == LANG_THA m_Static_HomeLink.SetColours( RGB( 190, 30, 20 ), RGB( 240, 130, 180), RGB( 112, 147, 219 ) ); #elif __CURRENT_LANG == LANG_RUS m_Static_HomeLink.SetColours( RGB( 255, 255, 255 ), RGB( 255, 0, 0 ), RGB( 0, 130, 0 ) ); #elif __CURRENT_LANG == LANG_GER m_Static_HomeLink.SetColours( RGB( 193, 177, 160 ), RGB( 255, 0, 0 ), RGB( 255, 0, 0 ) ); #elif __CURRENT_LANG == LANG_ENG // ascension m_Static_HomeLink.SetColours( RGB( 255, 255, 255 ), RGB( 0, 0, 255 ), RGB( 0, 0, 255 ) ); #elif __CURRENT_LANG == LANG_FRA m_Static_HomeLink.SetColours( RGB( 193, 177, 160 ), RGB( 255, 0, 0 ), RGB( 255, 0, 0 ) ); #elif __CURRENT_LANG == LANG_POR m_Static_HomeLink.SetColours( RGB( 255, 255, 255 ), RGB( 255, 0, 0 ), RGB( 255, 0, 0 ) ); #else m_Static_HomeLink.SetColours( RGB( 0, 0, 0), RGB( 255, 0, 0), RGB( 0, 130, 0 ) ); #endif m_Static_HomeLink.SetURL( szURL ); m_Static_HomeLink.SetUnderline( CHyperLink::ulAlways ); #ifdef __LANG_JAP //JAPAN 패치 클라이언트 이미지 변경관련 삭제. m_Static_HomeLink.EnableWindow(FALSE); m_Static_HomeLink.ShowWindow(FALSE); #endif //__LANG_JAP // Progress 초기화 m_File_Progress.SetPos(0); m_Total_Progress.SetPos(0); CreateWebControl( szWebURL ); GetDlgItem( IDC_BUTTON_START )->MoveWindow( 25, 465, 100, 20 ); GetDlgItem( IDC_BUTTON_REGISTER )->MoveWindow( 145, 465, 100, 20 ); GetDlgItem( IDC_OPTION )->MoveWindow( 250, 465, 100, 20 ); GetDlgItem( IDC_EXIT )->MoveWindow( 355, 465, 100, 20 ); GetDlgItem( IDC_CURRENT_STATE)->MoveWindow( 25, 495, 170, 20 ); GetDlgItem( IDC_DOWN_SPEED)->MoveWindow( 200, 495, 100, 20 ); GetDlgItem( IDC_FILE_NUMBER)->MoveWindow( 350, 495, 100, 20 ); GetDlgItem( IDC_FILEPROGRESS )->MoveWindow( 25, 515, 430, 20 ); GetDlgItem( IDC_TOTALPROGRESS)->MoveWindow( 25, 540, 430, 20 ); GetDlgItem( IDC_MASQUERADEVERSION)->MoveWindow( 200, 570-nInfoGap, 200, 20 ); return TRUE; }
// CBookManageDlg 对话框 CBookManageDlg::CBookManageDlg(CWnd* pParent /*=NULL*/) : CDialogEx(CBookManageDlg::IDD, pParent) , m_timer(_T("")) { m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); }
CClientDlg::CClientDlg(CWnd* pParent /*=NULL*/) : CDialogEx(CClientDlg::IDD, pParent), m_Client(this) { m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); }