这篇教程C++ AfxGetApp函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中AfxGetApp函数的典型用法代码示例。如果您正苦于以下问题:C++ AfxGetApp函数的具体用法?C++ AfxGetApp怎么用?C++ AfxGetApp使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了AfxGetApp函数的26个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: ggvoid CZSingleton::SetDrop(){ CString gg(AfxGetApp()->m_pszExeName); ::SetProp(AfxGetApp()->GetMainWnd()->GetSafeHwnd(), gg, (HANDLE)1); gg.Empty();}
开发者ID:zhaojunlucky,项目名称:Audio,代码行数:6,
示例2: SetDllDirectory//.........这里部分代码省略......... 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");
开发者ID:YueLinHo,项目名称:TortoiseSvn,代码行数:67,
示例3: TraySetIconvoid CTrayDialog::TraySetIcon(LPCTSTR lpszResourceName){ TraySetIcon(AfxGetApp()->LoadIcon(lpszResourceName));}
开发者ID:LjApps,项目名称:eMule-VeryCD,代码行数:4,
示例4: OnSiteDataInit// 现场数据对象初始化void CSensorListCtrl::OnSiteDataInit(){ data_base_helper_ = ((CLineApp*)AfxGetApp())->get_data_base_helper();}
开发者ID:svn2github,项目名称:jy00755131,代码行数:5,
示例5: AfxGetAppBOOL 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}
开发者ID:BackupTheBerlios,项目名称:reportasistent-svn,代码行数:61,
示例6: GetWindowTextBOOL 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));//.........这里部分代码省略.........
开发者ID:MXControl,项目名称:RoboServ,代码行数:101,
示例7: AfxGetAppBOOL CSystemTray::SetIcon(UINT nIDResource){ HICON hIcon = AfxGetApp()->LoadIcon(nIDResource); return SetIcon(hIcon);}
开发者ID:K0F,项目名称:2008,代码行数:6,
示例8: Scintilla_RegisterClasses// COpenHoldemApp initializationBOOL 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//.........这里部分代码省略.........
开发者ID:ohzooboy,项目名称:oh,代码行数:101,
示例9: CDialogExCStitchCamDlg::CStitchCamDlg(CWnd* pParent /*=NULL*/) : CDialogEx(CStitchCamDlg::IDD, pParent){ m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);}
开发者ID:neon-izm,项目名称:StitchCam,代码行数:5,
示例10: OnClosevoid CMainFrame::OnClose(){ static_cast<CHbgMainApp*>(AfxGetApp())->HbgGetEngine()->Finalize(); CFrameWndEx::OnClose();}
开发者ID:plantrue,项目名称:Hambugger,代码行数:6,
示例11: OnUpdateConnectedvoid CMainFrame::OnUpdateConnected(CCmdUI *pCmdUI){ pCmdUI->Enable(static_cast<CHbgMainApp*>(AfxGetApp())->HbgGetEngine()->Running());}
开发者ID:plantrue,项目名称:Hambugger,代码行数:4,
示例12: _TLONG 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;}
开发者ID:DanHenebry,项目名称:mpc-hc,代码行数:71,
示例13: SetIconint 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;}
开发者ID:Forlearngit,项目名称:HallQueFront,代码行数:90,
示例14: CDialogExCIPNotFound::CIPNotFound(CWnd* pParent /*=NULL*/) : CDialogEx(CIPNotFound::IDD, pParent){ m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); }
开发者ID:ChunmeiZhang915,项目名称:Talk2Me,代码行数:6,
示例15: AfxGetAppvoid CMainFrame::OnFileCloseAll(){ // TODO: 在此添加命令处理程序代码 AfxGetApp()->CloseAllDocuments(TRUE);}
开发者ID:ECNU-ZR,项目名称:physwf-c-lab,代码行数:5,
示例16: PrintPiecesThreadstatic 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;//.........这里部分代码省略.........
开发者ID:ldraw-linux,项目名称:leocad,代码行数:101,
示例17: dcvoid 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}
开发者ID:sanyaade-webdev,项目名称:wpub,代码行数:61,
示例18: CBaseRendererCMpcAudioRenderer::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); }}
开发者ID:AeonAxan,项目名称:mpc-hc,代码行数:70,
示例19: CDialogCTipDlg::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); } */}
开发者ID:sanyaade-webdev,项目名称:wpub,代码行数:63,
示例20: TRACE0void 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);}
开发者ID:BackupTheBerlios,项目名称:reportasistent-svn,代码行数:86,
示例21: COpenHoldemDoc * COpenHoldemDoc::GetDocument() { CFrameWnd * pFrame = (CFrameWnd *)(AfxGetApp()->m_pMainWnd); return (COpenHoldemDoc *) pFrame->GetActiveDocument();}
开发者ID:OpenHoldem,项目名称:openholdembot,代码行数:5,
示例22: CModelessDialogCDebugShadersDlg::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)); }}
开发者ID:1ldk,项目名称:mpc-hc,代码行数:71,
示例23: CDHtmlDialogCwowlauncherDlg::CwowlauncherDlg(CWnd* pParent /*=NULL*/) : CDHtmlDialog(CwowlauncherDlg::IDD, CwowlauncherDlg::IDH, pParent){ m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);}
开发者ID:Robin2000,项目名称:wowlauncher,代码行数:5,
示例24: SetWindowPos//.........这里部分代码省略......... 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 C++ AfxGetAppModuleState函数代码示例 C++ AfxFormatString1函数代码示例
|