/** * * \return */ BOOL CXavierEditorApp::InitInstance() { INITCOMMONCONTROLSEX InitCtrls; InitCtrls.dwSize = sizeof(InitCtrls); InitCtrls.dwICC = ICC_WIN95_CLASSES; InitCommonControlsEx(&InitCtrls); CWinAppEx::InitInstance(); ShowSplashDialog(); // 初始化 OLE 库 if (!AfxOleInit()) { AfxMessageBox(IDP_OLE_INIT_FAILED); return FALSE; } AfxEnableControlContainer(); SetRegistryKey(_T("XAVIER_EDITOR_VERSION_0")); LoadStdProfileSettings(4); InitContextMenuManager(); InitKeyboardManager(); InitTooltipManager(); CMFCToolTipInfo ttParams; ttParams.m_bVislManagerTheme = TRUE; theApp.GetTooltipManager()->SetTooltipParams(AFX_TOOLTIP_TYPE_ALL, RUNTIME_CLASS(CMFCToolTipCtrl), &ttParams); // 注册应用程序的文档模板。文档模板 // 将用作文档、框架窗口和视图之间的连接 CSingleDocTemplate* pDocTemplate; pDocTemplate = new CSingleDocTemplate( IDR_MAINFRAME, RUNTIME_CLASS(CXavierEditorDoc), RUNTIME_CLASS(CMainFrame), // 主 SDI 框架窗口 RUNTIME_CLASS(CXavierEditorView)); if (!pDocTemplate) return FALSE; AddDocTemplate(pDocTemplate); // 分析标准外壳命令、DDE、打开文件操作的命令行 CCommandLineInfo cmdInfo; ParseCommandLine(cmdInfo); // 调度在命令行中指定的命令。如果 // 用 /RegServer、/Register、/Unregserver 或 /Unregister 启动应用程序,则返回 FALSE。 if (!ProcessShellCommand(cmdInfo)) return FALSE; m_pMainWnd->ShowWindow(SW_SHOW); m_pMainWnd->UpdateWindow(); return TRUE; }
BOOL CStep6502App::InitInstance() { Initialize6502(); CWinAppEx::InitInstance(); EnableTaskbarInteraction(FALSE); // AfxInitRichEdit2() is required to use RichEdit control // AfxInitRichEdit2(); // 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 // TODO: You should modify this string to be something appropriate // such as the name of your company or organization SetRegistryKey(_T("x65")); InitContextMenuManager(); InitKeyboardManager(); InitTooltipManager(); CMFCToolTipInfo ttParams; ttParams.m_bVislManagerTheme = TRUE; theApp.GetTooltipManager()->SetTooltipParams(AFX_TOOLTIP_TYPE_ALL, RUNTIME_CLASS(CMFCToolTipCtrl), &ttParams); // 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; pMain = pFrame; m_pMainWnd = pFrame; // create and load the frame with its resources pFrame->LoadFrame(IDR_MAINFRAME, WS_OVERLAPPEDWINDOW | FWS_ADDTOTITLE, NULL, NULL); // The one and only window has been initialized, so show and update it pFrame->ShowWindow(SW_SHOW); pFrame->UpdateWindow(); return TRUE; }
BOOL CUIDesignerApp::InitInstance() { // 如果一个运行在 Windows XP 上的应用程序清单指定要 // 使用 ComCtl32.dll 版本 6 或更高版本来启用可视化方式, //则需要 InitCommonControlsEx()。否则,将无法创建窗口。 INITCOMMONCONTROLSEX InitCtrls; InitCtrls.dwSize = sizeof(InitCtrls); // 将它设置为包括所有要在应用程序中使用的 // 公共控件类。 InitCtrls.dwICC = ICC_WIN95_CLASSES; InitCommonControlsEx(&InitCtrls); CWinAppEx::InitInstance(); // 初始化 OLE 库 if (!AfxOleInit()) { AfxMessageBox(IDP_OLE_INIT_FAILED); return FALSE; } AfxEnableControlContainer(); // 标准初始化 // 如果未使用这些功能并希望减小 // 最终可执行文件的大小,则应移除下列 // 不需要的特定初始化例程 // 更改用于存储设置的注册表项 // TODO: 应适当修改该字符串, // 例如修改为公司或组织名 SetRegistryKey(_T("")); LoadStdProfileSettings(); // 加载标准 INI 文件选项(包括 MRU) SetRegistryBase(_T("Settings")); CPaintManagerUI::LoadPlugin(_T("mgyUI_Plugin.dll")); InitContextMenuManager(); InitKeyboardManager(); InitTooltipManager(); CMFCToolTipInfo ttParams; ttParams.m_bVislManagerTheme = TRUE; theApp.GetTooltipManager()->SetTooltipParams(AFX_TOOLTIP_TYPE_ALL, RUNTIME_CLASS(CMFCToolTipCtrl), &ttParams); // 注册应用程序的文档模板。文档模板 // 将用作文档、框架窗口和视图之间的连接 m_pUIDocTemplate = new CMultiDocTemplate(IDR_UIDESIGNER, RUNTIME_CLASS(CUIDesignerDoc), RUNTIME_CLASS(CChildFrame), // 自定义 MDI 子框架 RUNTIME_CLASS(CUIDesignerView)); if (!m_pUIDocTemplate) return FALSE; AddDocTemplate(m_pUIDocTemplate); // 创建主 MDI 框架窗口 CMainFrame* pMainFrame = new CMainFrame; if (!pMainFrame || !pMainFrame->LoadFrame(IDR_MAINFRAME)) { delete pMainFrame; return FALSE; } m_pMainWnd = pMainFrame; m_pMainWnd->SetWindowText(_T("Dui Designer")); // 仅当具有后缀时才调用 DragAcceptFiles // 在 MDI 应用程序中,这应在设置 m_pMainWnd 之后立即发生 // 启用拖/放 m_pMainWnd->DragAcceptFiles(); // 启用“DDE 执行” EnableShellOpen(); RegisterShellFileTypes(TRUE); // 主窗口已初始化,因此显示它并对其进行更新 pMainFrame->ShowWindow(SW_SHOWMAXIMIZED); pMainFrame->UpdateWindow(); return TRUE; }
BOOL CScratchPadApp::InitInstance() { // 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); CWinAppEx::InitInstance(); EnableTaskbarInteraction(FALSE); // AfxInitRichEdit2() is required to use RichEdit control // AfxInitRichEdit2(); // 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 // TODO: You should modify this string to be something appropriate // such as the name of your company or organization SetRegistryKey(_T("Local AppWizard-Generated Applications")); InitContextMenuManager(); InitKeyboardManager(); InitTooltipManager(); CMFCToolTipInfo ttParams; ttParams.m_bVislManagerTheme = TRUE; theApp.GetTooltipManager()->SetTooltipParams(AFX_TOOLTIP_TYPE_ALL, RUNTIME_CLASS(CMFCToolTipCtrl), &ttParams); // 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 pFrame->LoadFrame(IDR_MAINFRAME, WS_OVERLAPPEDWINDOW | FWS_ADDTOTITLE, NULL, NULL); // The one and only window has been initialized, so show and update it pFrame->ShowWindow(SW_SHOW); pFrame->UpdateWindow(); // call DragAcceptFiles only if there's a suffix // In an SDI app, this should occur after ProcessShellCommand BYTE digitizerStatus = (BYTE) GetSystemMetrics(SM_DIGITIZER); if ((digitizerStatus & (0x80 + 0x40)) == 0) //Stack Ready + MultiTouch { AfxMessageBox(L"No touch input is currently availible."); return FALSE; } BYTE nInputs = (BYTE) GetSystemMetrics(SM_MAXIMUMTOUCHES); CString str; str.Format(L"Touch input available with %d touch points.", nInputs); AfxMessageBox(str); return TRUE; }
BOOL CWordPadApp::InitInstance() { ParseCommandLine(cmdInfo); if (::FindWindow(szWordPadClass, NULL) && IsDocOpen(cmdInfo.m_strFileName)) return FALSE; SetRegistryKey(szRegKey); LoadOptions(); Enable3dControls(); CSplashWnd splash; BOOL bSplash = cmdInfo.m_bShowSplash; if (!cmdInfo.m_bRunEmbedded) { switch (m_nCmdShow) { case SW_HIDE: case SW_SHOWMINIMIZED: case SW_MINIMIZE: case SW_SHOWMINNOACTIVE: bSplash = FALSE; break; case SW_RESTORE: case SW_SHOW: case SW_SHOWDEFAULT: case SW_SHOWNA: case SW_SHOWNOACTIVATE: case SW_SHOWNORMAL: case SW_SHOWMAXIMIZED: if (m_bMaximized) m_nCmdShow = SW_SHOWMAXIMIZED; break; } } else { //Excel 4 will start OLE servers minimized m_nCmdShow = SW_SHOWNORMAL; } int nCmdShow = m_nCmdShow; if (bSplash) { // only show splash if not embedded splash.Create(NULL); splash.ShowWindow(SW_SHOW); splash.UpdateWindow(); } LoadAbbrevStrings(); #ifdef CREATE_DEV_NAMES m_hDevNames = CreateDevNames(); #else m_hDevNames = NULL; #endif NotifyPrinterChanged((m_hDevNames == NULL)); free((void*)m_pszHelpFilePath); m_pszHelpFilePath = _T("WORDPAD.HLP"); // Initialize OLE libraries if (!AfxOleInit()) { AfxMessageBox(IDP_OLE_INIT_FAILED); return FALSE; } RegisterFormats(); // Initialize RichEdit control if (LoadLibrary(_T("RICHED32.DLL")) == NULL) { AfxMessageBox(IDS_RICHED_LOAD_FAIL, MB_OK|MB_ICONEXCLAMATION); return FALSE; } // 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. LoadStdProfileSettings(); // Load standard INI file options (including MRU) // Initialize all Managers for usage. They are automatically constructed // if not yet present SetRegistryBase (_T("SettingsPro")); InitContextMenuManager(); InitKeyboardManager(); InitTooltipManager(); CMFCToolTipInfo params; params.m_bVislManagerTheme = TRUE; theApp.GetTooltipManager ()->SetTooltipParams ( 0xFFFF, RUNTIME_CLASS (CMFCToolTipCtrl), ¶ms); EnableTearOffMenus (NULL, ID_FREE_TEAROFF1, ID_FREE_TEAROFF2); // Register the application's document templates. Document templates // serve as the connection between documents, frame windows and views. DocTemplate.SetContainerInfo(IDR_CNTR_INPLACE); DocTemplate.SetServerInfo( IDR_SRVR_EMBEDDED, IDR_SRVR_INPLACE, RUNTIME_CLASS(CInPlaceFrame)); // Connect the COleTemplateServer to the document template. // The COleTemplateServer creates new documents on behalf // of requesting OLE containers by using information // specified in the document template. m_server.ConnectTemplate(clsid, &DocTemplate, TRUE); // Note: SDI applications register server objects only if /Embedding // or /Automation is present on the command line. // Check to see if launched as OLE server if (cmdInfo.m_bRunEmbedded || cmdInfo.m_bRunAutomated) { // Register all OLE server (factories) as running. This enables the // OLE libraries to create objects from other applications. COleTemplateServer::RegisterAll(); AfxOleSetUserCtrl(FALSE); // Application was run with /Embedding or /Automation. Don't show the // main window in this case. return TRUE; } // make sure the main window is showing m_bPromptForType = FALSE; OnFileNew(); m_bPromptForType = TRUE; // destroy splash window if (cmdInfo.m_bShowSplash) splash.DestroyWindow(); m_nCmdShow = -1; if (m_pMainWnd == NULL) // i.e. OnFileNew failed return FALSE; if (!cmdInfo.m_strFileName.IsEmpty()) // open an existing document m_nCmdShow = nCmdShow; // Dispatch commands specified on the command line if (cmdInfo.m_nShellCommand != CCommandLineInfo::FileNew && !ProcessShellCommand(cmdInfo)) { return FALSE; } LoadCustomState (); // Enable File Manager drag/drop open m_pMainWnd->DragAcceptFiles(); // When a server application is launched stand-alone, it is a good idea // to update the system registry in case it has been damaged. // do registry stuff in separate thread #ifndef _UNICODE if (m_bWin31) // no threads on Win32s UpdateRegistry(); else #endif AfxBeginThread(DoRegistry, this, THREAD_PRIORITY_IDLE); if (afxGlobalData.m_nBitsPerPixel < 16) { AfxMessageBox(IDS_WRONG_DISPLAY_SETTINGS); } // Set application general look: CAppLookDlg dlg (TRUE); dlg.DoModal (); return TRUE; }
BOOL CTreeDrawingApp::InitInstance() { // 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); CWinAppEx::InitInstance(); // 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 // TODO: You should modify this string to be something appropriate // such as the name of your company or organization SetRegistryKey(_T("Local AppWizard-Generated Applications")); InitContextMenuManager(); InitKeyboardManager(); InitTooltipManager(); CMFCToolTipInfo ttParams; ttParams.m_bVislManagerTheme = TRUE; theApp.GetTooltipManager()->SetTooltipParams(AFX_TOOLTIP_TYPE_ALL, RUNTIME_CLASS(CMFCToolTipCtrl), &ttParams); // 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 pFrame->LoadFrame(IDR_MAINFRAME, WS_OVERLAPPEDWINDOW | FWS_ADDTOTITLE, NULL, NULL); // The one and only window has been initialized, so show and update it pFrame->ShowWindow(SW_SHOW); pFrame->UpdateWindow(); // call DragAcceptFiles only if there's a suffix // In an SDI app, this should occur after ProcessShellCommand return TRUE; }
BOOL CQueryBuilderApp::InitInstance() { HRESULT hRes = _Module.Init(NULL, m_hInstance); ATLASSERT(SUCCEEDED(hRes)); #ifndef _DEBUG // Setup exception handler BT_SetAppName(_T("ECL IDE")); BT_SetSupportEMail(_T("*****@*****.**")); BT_SetFlags(BTF_DETAILEDMODE | BTF_EDITMAIL | BTF_ATTACHREPORT); BT_SetSupportURL(_T("http://hpccsystems.com/support")); // = BugTrapServer =========================================== //BT_SetSupportServer(_T("localhost"), 9999); // - or - //BT_SetSupportServer(_T("127.0.0.1"), 9999); // = BugTrapWebServer ======================================== //BT_SetSupportServer(_T("http://localhost/BugTrapWebServer/RequestHandler.aspx"), BUGTRAP_HTTP_PORT); // required since VS 2005 SP1 BT_InstallSehFilter(); #endif // 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); CWinAppEx::InitInstance(); // 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 // TODO: You should modify this string to be something appropriate // such as the name of your company or organization HINSTANCE hInstanceResources = ::LoadLibrary(_T("en_us.dll")); _Module.SetResourceInstance(hInstanceResources); AfxSetResourceHandle(hInstanceResources); SetApplicationName(_T("eclide.exe")); boost::filesystem::path iniPath; GetIniPath(iniPath); CComPtr<IConfig> ini = CreateIConfig(QUERYBUILDER_INI, iniPath); CComPtr<IConfig> config = CreateIConfig(QUERYBUILDER_CFG); if (!hGrid) hGrid = ::LoadLibrary(SGRID::CGridCtrl::GetLibraryName()); std::_tstring majorVersion; GetAppMajorVersion(majorVersion); SetRegistryKey((boost::_tformat(_T("HPCC Systems\\Version%1%")) % majorVersion).str().c_str()); LoadStdProfileSettings(0); // Load standard INI file options InitContextMenuManager(); InitKeyboardManager(); InitTooltipManager(); CMFCToolTipInfo ttParams; ttParams.m_bVislManagerTheme = TRUE; theApp.GetTooltipManager()->SetTooltipParams(AFX_TOOLTIP_TYPE_ALL, RUNTIME_CLASS(CMFCToolTipCtrl), &ttParams); theApp.EnableTaskbarInteraction(false); //const TCHAR * path = _tgetenv(_T("PATH")); //if (path) //{ // const TCHAR * hpccbin = _tgetenv(_T("HPCCBIN")); // if (hpccbin) // { // boost::filesystem::wpath eclccPath = hpccbin; // eclccPath /= _T("eclcc.exe"); // if (boost::filesystem::exists(eclccPath)) // { // std::_tstring envVar = _T("PATH="); // envVar += hpccbin; // envVar += _T(";"); // envVar += path; // _tputenv(envVar.c_str()); // ini->Set(GLOBAL_COMPILER_LOCATION, eclccPath.native_file_string()); // } // boost::filesystem::wpath stdLibPath = hpccbin; // stdLibPath /= _T("ecllib"); // if (boost::filesystem::exists(stdLibPath)) // { // ini->Set(GLOBAL_COMPILER_STDLIB, stdLibPath.native_file_string()); // } // } //} // To create the main window, this code creates a new frame window // object and then sets it as the application's main window object CMDIFrameWnd* pFrame = new CMainFrame; if (!pFrame) return FALSE; m_pMainWnd = pFrame; // create main MDI frame window if (!pFrame->LoadFrame(IDR_MAINFRAME)) return FALSE; // try to load shared MDI menus and accelerator table //TODO: add additional member variables and load calls for // additional menu types your application may need //HINSTANCE hInst = AfxGetResourceHandle(); //m_hMDIMenu = ::LoadMenu(hInst, MAKEINTRESOURCE(IDR_QueryBuilderTYPE)); //m_hMDIAccel = ::LoadAccelerators(hInst, MAKEINTRESOURCE(IDR_QueryBuilderTYPE)); // The main window has been initialized, so show and update it pFrame->ShowWindow(m_nCmdShow); pFrame->UpdateWindow(); return TRUE; }
BOOL CYPaintEditApp::InitInstance() { CWinAppEx::InitInstance(); // OLE 라이브러리를 초기화합니다. if (!AfxOleInit()) { AfxMessageBox(IDP_OLE_INIT_FAILED); return FALSE; } EnableTaskbarInteraction(FALSE); // RichEdit 컨트롤을 사용하려면 AfxInitRichEdit2()가 있어야 합니다. // AfxInitRichEdit2(); // 표준 초기화 // 이들 기능을 사용하지 않고 최종 실행 파일의 크기를 줄이려면 // 아래에서 필요 없는 특정 초기화 // 루틴을 제거해야 합니다. // 해당 설정이 저장된 레지스트리 키를 변경하십시오. // TODO: 이 문자열을 회사 또는 조직의 이름과 같은 // 적절한 내용으로 수정해야 합니다. SetRegistryKey(_T("로컬 응용 프로그램 마법사에서 생성된 응용 프로그램")); LoadStdProfileSettings(4); // MRU를 포함하여 표준 INI 파일 옵션을 로드합니다. InitContextMenuManager(); InitKeyboardManager(); InitTooltipManager(); CMFCToolTipInfo ttParams; ttParams.m_bVislManagerTheme = TRUE; theApp.GetTooltipManager()->SetTooltipParams(AFX_TOOLTIP_TYPE_ALL, RUNTIME_CLASS(CMFCToolTipCtrl), &ttParams); // 응용 프로그램의 문서 템플릿을 등록합니다. 문서 템플릿은 // 문서, 프레임 창 및 뷰 사이의 연결 역할을 합니다. CMultiDocTemplate* pDocTemplate; pDocTemplate = new CMultiDocTemplate(IDR_YPaintEditTYPE, RUNTIME_CLASS(CYPaintEditDoc), RUNTIME_CLASS(CChildFrame), // 사용자 지정 MDI 자식 프레임입니다. RUNTIME_CLASS(CYPaintEditView)); if (!pDocTemplate) return FALSE; AddDocTemplate(pDocTemplate); // 주 MDI 프레임 창을 만듭니다. CMainFrame* pMainFrame = new CMainFrame; if (!pMainFrame || !pMainFrame->LoadFrame(IDR_MAINFRAME)) { delete pMainFrame; return FALSE; } m_pMainWnd = pMainFrame; // 접미사가 있을 경우에만 DragAcceptFiles를 호출합니다. // MDI 응용 프로그램에서는 m_pMainWnd를 설정한 후 바로 이러한 호출이 발생해야 합니다. // 끌어서 놓기에 대한 열기를 활성화합니다. m_pMainWnd->DragAcceptFiles(); // 표준 셸 명령, DDE, 파일 열기에 대한 명령줄을 구문 분석합니다. CCommandLineInfo cmdInfo; ParseCommandLine(cmdInfo); // DDE Execute 열기를 활성화합니다. EnableShellOpen(); RegisterShellFileTypes(TRUE); // 명령줄에 지정된 명령을 디스패치합니다. // 응용 프로그램이 /RegServer, /Register, /Unregserver 또는 /Unregister로 시작된 경우 FALSE를 반환합니다. if (!ProcessShellCommand(cmdInfo)) return FALSE; // 주 창이 초기화되었으므로 이를 표시하고 업데이트합니다. pMainFrame->ShowWindow(m_nCmdShow); pMainFrame->UpdateWindow(); return TRUE; }
BOOL Cp00MenuApp::InitInstance() { // 응용 프로그램 매니페스트가 ComCtl32.dll 버전 6 이상을 사용하여 비주얼 스타일을 // 사용하도록 지정하는 경우, Windows XP 상에서 반드시 InitCommonControlsEx()가 필요합니다. // InitCommonControlsEx()를 사용하지 않으면 창을 만들 수 없습니다. INITCOMMONCONTROLSEX InitCtrls; InitCtrls.dwSize = sizeof(InitCtrls); // 응용 프로그램에서 사용할 모든 공용 컨트롤 클래스를 포함하도록 // 이 항목을 설정하십시오. InitCtrls.dwICC = ICC_WIN95_CLASSES; InitCommonControlsEx(&InitCtrls); CWinAppEx::InitInstance(); // OLE 라이브러리를 초기화합니다. if (!AfxOleInit()) { AfxMessageBox(IDP_OLE_INIT_FAILED); return FALSE; } AfxEnableControlContainer(); EnableTaskbarInteraction(FALSE); // RichEdit 컨트롤을 사용하려면 AfxInitRichEdit2()가 있어야 합니다. // AfxInitRichEdit2(); // 표준 초기화 // 이들 기능을 사용하지 않고 최종 실행 파일의 크기를 줄이려면 // 아래에서 필요 없는 특정 초기화 // 루틴을 제거해야 합니다. // 해당 설정이 저장된 레지스트리 키를 변경하십시오. // TODO: 이 문자열을 회사 또는 조직의 이름과 같은 // 적절한 내용으로 수정해야 합니다. SetRegistryKey(_T("로컬 응용 프로그램 마법사에서 생성된 응용 프로그램")); InitContextMenuManager(); InitKeyboardManager(); InitTooltipManager(); CMFCToolTipInfo ttParams; ttParams.m_bVislManagerTheme = TRUE; theApp.GetTooltipManager()->SetTooltipParams(AFX_TOOLTIP_TYPE_ALL, RUNTIME_CLASS(CMFCToolTipCtrl), &ttParams); // 주 창을 만들기 위해 이 코드에서는 새 프레임 창 개체를 // 만든 다음 이를 응용 프로그램의 주 창 개체로 설정합니다. CMainFrame* pFrame = new CMainFrame; if (!pFrame) return FALSE; m_pMainWnd = pFrame; // 프레임을 만들어 리소스와 함께 로드합니다. pFrame->LoadFrame(IDR_MAINFRAME, WS_OVERLAPPEDWINDOW | FWS_ADDTOTITLE, NULL, NULL); // 창 하나만 초기화되었으므로 이를 표시하고 업데이트합니다. pFrame->ShowWindow(SW_SHOW); pFrame->UpdateWindow(); // 접미사가 있을 경우에만 DragAcceptFiles를 호출합니다. // SDI 응용 프로그램에서는 ProcessShellCommand 후에 이러한 호출이 발생해야 합니다. return TRUE; }
BOOL CTortoiseGitBlameApp::InitInstance() { { DWORD len = GetCurrentDirectory(0, NULL); if (len) { std::unique_ptr<TCHAR[]> originalCurrentDirectory(new 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(_T("Software\\TortoiseGit\\LanguageID"), 1033); long langId = loc; CString langDll; HINSTANCE hInst = NULL; do { langDll.Format(_T("%sLanguages\\TortoiseGitBlame%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 = NULL; } if (hInst != NULL) AfxSetResourceHandle(hInst); else { DWORD lid = SUBLANGID(langId); lid--; if (lid > 0) { langId = MAKELANGID(PRIMARYLANGID(langId), lid); } else langId = 0; } } while ((hInst == NULL) && (langId != 0)); TCHAR buf[6] = { 0 }; _tcscpy_s(buf, _T("en")); langId = loc; CString sHelppath; sHelppath = this->m_pszHelpFilePath; sHelppath = sHelppath.MakeLower(); sHelppath.Replace(_T(".chm"), _T("_en.chm")); free((void*)m_pszHelpFilePath); m_pszHelpFilePath=_tcsdup(sHelppath); sHelppath = CPathUtils::GetAppParentDirectory() + _T("Languages\\TortoiseGitBlame_en.chm"); do { GetLocaleInfo(MAKELCID(langId, SORT_DEFAULT), LOCALE_SISO639LANGNAME, buf, _countof(buf)); CString sLang = _T("_"); sLang += buf; sHelppath.Replace(_T("_en"), sLang); if (PathFileExists(sHelppath)) { free((void*)m_pszHelpFilePath); m_pszHelpFilePath=_tcsdup(sHelppath); break; } sHelppath.Replace(sLang, _T("_en")); GetLocaleInfo(MAKELCID(langId, SORT_DEFAULT), LOCALE_SISO3166CTRYNAME, buf, _countof(buf)); sLang += _T("_"); sLang += buf; sHelppath.Replace(_T("_en"), sLang); if (PathFileExists(sHelppath)) { free((void*)m_pszHelpFilePath); m_pszHelpFilePath=_tcsdup(sHelppath); break; } sHelppath.Replace(sLang, _T("_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); // 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); CWinAppEx::InitInstance(); Gdiplus::GdiplusStartupInput gdiplusStartupInput; Gdiplus::GdiplusStartup(&m_gdiplusToken,&gdiplusStartupInput,NULL); // 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(_T("TortoiseGit")); LoadStdProfileSettings(4); // Load standard INI file options (including MRU) InitContextMenuManager(); InitKeyboardManager(); InitTooltipManager(); CMFCToolTipInfo ttParams; ttParams.m_bVislManagerTheme = TRUE; theApp.GetTooltipManager()->SetTooltipParams(AFX_TOOLTIP_TYPE_ALL, RUNTIME_CLASS(CMFCToolTipCtrl), &ttParams); // Register the application's document templates. Document templates // serve as the connection between documents, frame windows and views CSingleDocTemplate* pDocTemplate; pDocTemplate = new CSingleDocTemplate( IDR_TORTOISE_GIT_BLAME_MAINFRAME, RUNTIME_CLASS(CTortoiseGitBlameDoc), RUNTIME_CLASS(CMainFrame), // main SDI frame window RUNTIME_CLASS(CTortoiseGitBlameView)); if (!pDocTemplate) return FALSE; AddDocTemplate(pDocTemplate); CCmdLineParser parser = CCmdLineParser(this->m_lpCmdLine); g_sGroupingUUID = parser.GetVal(L"groupuuid"); // Parse command line for standard shell commands, DDE, file open CCommandLineInfo cmdInfo; ParseCommandLine(cmdInfo); // 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; // The one and only window has been initialized, so show and update it 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 return TRUE; }
BOOL CMFCCTreeCtrlApp::InitInstance() { // アプリケーション マニフェストが visual スタイルを有効にするために、 // ComCtl32.dll Version 6 以降の使用を指定する場合は、 // Windows XP に InitCommonControlsEx() が必要です。さもなければ、ウィンドウ作成はすべて失敗します。 INITCOMMONCONTROLSEX InitCtrls; InitCtrls.dwSize = sizeof(InitCtrls); // アプリケーションで使用するすべてのコモン コントロール クラスを含めるには、 // これを設定します。 InitCtrls.dwICC = ICC_WIN95_CLASSES; InitCommonControlsEx(&InitCtrls); CWinAppEx::InitInstance(); // OLE ライブラリを初期化します。 if (!AfxOleInit()) { AfxMessageBox(IDP_OLE_INIT_FAILED); return FALSE; } AfxEnableControlContainer(); EnableTaskbarInteraction(FALSE); // RichEdit コントロールを使用するには AfxInitRichEdit2() が必要です // AfxInitRichEdit2(); // 標準初期化 // これらの機能を使わずに最終的な実行可能ファイルの // サイズを縮小したい場合は、以下から不要な初期化 // ルーチンを削除してください。 // 設定が格納されているレジストリ キーを変更します。 // TODO: 会社名または組織名などの適切な文字列に // この文字列を変更してください。 SetRegistryKey(_T("アプリケーション ウィザードで生成されたローカル アプリケーション")); InitContextMenuManager(); InitKeyboardManager(); InitTooltipManager(); CMFCToolTipInfo ttParams; ttParams.m_bVislManagerTheme = TRUE; theApp.GetTooltipManager()->SetTooltipParams(AFX_TOOLTIP_TYPE_ALL, RUNTIME_CLASS(CMFCToolTipCtrl), &ttParams); // メイン ウィンドウを作成するとき、このコードは新しいフレーム ウィンドウ オブジェクトを作成し、 // それをアプリケーションのメイン ウィンドウにセットします CMainFrame* pFrame = new CMainFrame; if (!pFrame) return FALSE; m_pMainWnd = pFrame; // フレームをリソースからロードして作成します pFrame->LoadFrame(IDR_MAINFRAME, WS_OVERLAPPEDWINDOW | FWS_ADDTOTITLE, NULL, NULL); // メイン ウィンドウが初期化されたので、表示と更新を行います。 pFrame->ShowWindow(SW_SHOW); pFrame->UpdateWindow(); return TRUE; }
BOOL CGamepadApp::InitInstance() { // InitCommonControlsEx() требуются для Windows XP, если манифест // приложения использует ComCtl32.dll версии 6 или более поздней версии для включения // стилей отображения. В противном случае будет возникать сбой при создании любого окна. INITCOMMONCONTROLSEX InitCtrls; InitCtrls.dwSize = sizeof(InitCtrls); // Выберите этот параметр для включения всех общих классов управления, которые необходимо использовать // в вашем приложении. InitCtrls.dwICC = ICC_WIN95_CLASSES; InitCommonControlsEx(&InitCtrls); CWinAppEx::InitInstance(); EnableTaskbarInteraction(FALSE); // Для использования элемента управления RichEdit требуется метод AfxInitRichEdit2() // AfxInitRichEdit2(); // Стандартная инициализация // Если эти возможности не используются и необходимо уменьшить размер // конечного исполняемого файла, необходимо удалить из следующего // конкретные процедуры инициализации, которые не требуются // Измените раздел реестра, в котором хранятся параметры // TODO: следует изменить эту строку на что-нибудь подходящее, // например на название организации SetRegistryKey(_T("Локальные приложения, созданные с помощью мастера приложений")); InitContextMenuManager(); InitKeyboardManager(); InitTooltipManager(); CMFCToolTipInfo ttParams; ttParams.m_bVislManagerTheme = TRUE; theApp.GetTooltipManager()->SetTooltipParams(AFX_TOOLTIP_TYPE_ALL, RUNTIME_CLASS(CMFCToolTipCtrl), &ttParams); // Чтобы создать главное окно, этот код создает новый объект окна // рамки, а затем задает его как объект основного окна приложения CMainFrame* pFrame = new CMainFrame; if (!pFrame) return FALSE; m_pMainWnd = pFrame; // создайте и загрузите рамку с его ресурсами pFrame->LoadFrame(IDR_MAINFRAME, WS_OVERLAPPEDWINDOW | FWS_ADDTOTITLE, NULL, NULL); // Разрешить использование расширенных символов в горячих клавишах меню CMFCToolBar::m_bExtCharTranslation = TRUE; // Одно и только одно окно было инициализировано, поэтому отобразите и обновите его pFrame->ShowWindow(SW_SHOWMAXIMIZED); pFrame->UpdateWindow(); return TRUE; }
BOOL CBCGPOrganizerApp::InitInstance() { // 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. #if _MSC_VER < 1400 #ifdef _AFXDLL Enable3dControls(); // Call this when using MFC in a shared DLL #else Enable3dControlsStatic(); // Call this when linking to MFC statically #endif #endif // Change the registry key under which our settings are stored. // TODO: You should modify this string to be something appropriate // such as the name of your company or organization. SetRegistryKey(_T("BCGSoft\\BCGControlBarPro\\Examples")); LoadStdProfileSettings(0); // Load standard INI file options (including MRU) SetRegistryBase (_T("Settings2")); m_OptionsPlanner.Load (); m_OptionsGantt.Load (); // Initialize all Managers for usage. They are automatically constructed // if not yet present InitContextMenuManager(); InitKeyboardManager(); InitTooltipManager(); m_bShowFloaty = GetInt (_T("ShowFloaty"), TRUE); m_nAppLook = GetInt (_T("ApplicationLook"), 1); m_bShowToolTips = GetInt (_T("ShowToolTips"), TRUE); m_bShowKeyTips = GetInt (_T("ShowKeyTips"), TRUE); m_bShowToolTipDescr = GetInt (_T("ShowToolTipDescription"), TRUE); CBCGPToolTipParams params; params.m_bVislManagerTheme = TRUE; globalData.m_nMaxToolTipWidth = 150; theApp.GetTooltipManager ()->SetTooltipParams ( 0xFFFF, RUNTIME_CLASS (CRibbonTooltipCtrl), ¶ms); if (m_OptionsPlanner.m_ShowToolTip == 2) { GetTooltipManager ()->SetTooltipParams ( BCGP_TOOLTIP_TYPE_PLANNER, RUNTIME_CLASS (CPlannerTooltipCtrl), ¶ms); } if (m_OptionsGantt.m_ShowToolTip == 2) { GetTooltipManager ()->SetTooltipParams ( BCGP_TOOLTIP_TYPE_GANTT, RUNTIME_CLASS (CGanttTooltipCtrl), ¶ms); } // 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(CBCGPOrganizerDoc), RUNTIME_CLASS(CMainFrame), // main SDI frame window RUNTIME_CLASS(CBCGPOrganizerView)); AddDocTemplate(pDocTemplate); // Parse command line for standard shell commands, DDE, file open CCommandLineInfo cmdInfo; ParseCommandLine(cmdInfo); // Dispatch commands specified on the command line if (!ProcessShellCommand(cmdInfo)) return FALSE; // The one and only window has been initialized, so show and update it. m_pMainWnd->ShowWindow(SW_SHOW); /* CRect rect; m_pMainWnd->GetWindowRect (rect); m_pMainWnd->SetWindowPos (NULL, -1, -1, rect.Width (), rect.Height (), SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE); */ m_pMainWnd->UpdateWindow(); return TRUE; }
BOOL CUPIMServerApp::InitInstance() { CWinAppEx::InitInstance(); SetErrorMode(1|2); LPTOP_LEVEL_EXCEPTION_FILTER pPrevFilter = ::SetUnhandledExceptionFilter(MyExptFilter); if(pPrevFilter != NULL) _tprintf(_T("Previous exception filter exists.\n")); else _tprintf(_T("No Previous exception filter.\n")); EnableTaskbarInteraction(FALSE); // 使用 RichEdit 控件需要 AfxInitRichEdit2() // AfxInitRichEdit2(); // 标准初始化 // 如果未使用这些功能并希望减小 // 最终可执行文件的大小,则应移除下列 // 不需要的特定初始化例程 // 更改用于存储设置的注册表项 // TODO: 应适当修改该字符串, // 例如修改为公司或组织名 SetRegistryKey(_T("UPIMSEVER_1.0.3.1_1")); LoadStdProfileSettings(4); // 加载标准 INI 文件选项(包括 MRU) InitContextMenuManager(); InitKeyboardManager(); InitTooltipManager(); CMFCToolTipInfo ttParams; ttParams.m_bVislManagerTheme = TRUE; theApp.GetTooltipManager()->SetTooltipParams(AFX_TOOLTIP_TYPE_ALL, RUNTIME_CLASS(CMFCToolTipCtrl), &ttParams); // 注册应用程序的文档模板。文档模板 // 将用作文档、框架窗口和视图之间的连接 CSingleDocTemplate* pDocTemplate; pDocTemplate = new CSingleDocTemplate( IDR_MYMENU, RUNTIME_CLASS(CUPIMServerDoc), RUNTIME_CLASS(CMainFrame), // 主 SDI 框架窗口 RUNTIME_CLASS(CUPIMServerView)); if (!pDocTemplate) return FALSE; AddDocTemplate(pDocTemplate); // 分析标准 shell 命令、DDE、打开文件操作的命令行 CCommandLineInfo cmdInfo; ParseCommandLine(cmdInfo); // 调度在命令行中指定的命令。如果 // 用 /RegServer、/Register、/Unregserver 或 /Unregister 启动应用程序,则返回 FALSE。 if (!ProcessShellCommand(cmdInfo)) return FALSE; // 唯一的一个窗口已初始化,因此显示它并对其进行更新 m_pMainWnd->ShowWindow(SW_SHOW); m_pMainWnd->UpdateWindow(); // 仅当具有后缀时才调用 DragAcceptFiles // 在 SDI 应用程序中,这应在 ProcessShellCommand 之后发生 return TRUE; }
BOOL CVRSim3DGlobeApp::InitInstance() { CWinAppEx::InitInstance(); // 初始化 OLE 库 if (!AfxOleInit()) { AfxMessageBox(IDP_OLE_INIT_FAILED); return FALSE; } EnableTaskbarInteraction(FALSE); // 使用 RichEdit 控件需要 AfxInitRichEdit2() // AfxInitRichEdit2(); // 标准初始化 // 如果未使用这些功能并希望减小 // 最终可执行文件的大小,则应移除下列 // 不需要的特定初始化例程 // 更改用于存储设置的注册表项 // TODO: 应适当修改该字符串, // 例如修改为公司或组织名 SetRegistryKey(_T("应用程序向导生成的本地应用程序")); LoadStdProfileSettings(4); // 加载标准 INI 文件选项(包括 MRU) InitContextMenuManager(); InitKeyboardManager(); InitTooltipManager(); CMFCToolTipInfo ttParams; ttParams.m_bVislManagerTheme = TRUE; theApp.GetTooltipManager()->SetTooltipParams(AFX_TOOLTIP_TYPE_ALL, RUNTIME_CLASS(CMFCToolTipCtrl), &ttParams); // 注册应用程序的文档模板。文档模板 // 将用作文档、框架窗口和视图之间的连接 CSingleDocTemplate* pDocTemplate; pDocTemplate = new CSingleDocTemplate( IDR_MAINFRAME, RUNTIME_CLASS(CVRSim3DGlobeDoc), RUNTIME_CLASS(CMainFrame), // 主 SDI 框架窗口 RUNTIME_CLASS(CVRSim3DGlobeView)); if (!pDocTemplate) return FALSE; AddDocTemplate(pDocTemplate); // 分析标准 shell 命令、DDE、打开文件操作的命令行 CCommandLineInfo cmdInfo; ParseCommandLine(cmdInfo); // 调度在命令行中指定的命令。如果 // 用 /RegServer、/Register、/Unregserver 或 /Unregister 启动应用程序,则返回 FALSE。 if (!ProcessShellCommand(cmdInfo)) return FALSE; // 唯一的一个窗口已初始化,因此显示它并对其进行更新 m_pMainWnd->ShowWindow(SW_SHOWMAXIMIZED); m_pMainWnd->UpdateWindow(); // 仅当具有后缀时才调用 DragAcceptFiles // 在 SDI 应用程序中,这应在 ProcessShellCommand 之后发生 return TRUE; }
BOOL CATradeApp::InitInstance() { // 如果一个运行在 Windows XP 上的应用程序清单指定要 // 使用 ComCtl32.dll 版本 6 或更高版本来启用可视化方式, //则需要 InitCommonControlsEx()。 否则,将无法创建窗口。 INITCOMMONCONTROLSEX InitCtrls; InitCtrls.dwSize = sizeof(InitCtrls); // 将它设置为包括所有要在应用程序中使用的 // 公共控件类。 InitCtrls.dwICC = ICC_WIN95_CLASSES; InitCommonControlsEx(&InitCtrls); CWinAppEx::InitInstance(); AfxSocketInit(); // 初始化 OLE 库 if (!AfxOleInit()) { AfxMessageBox(IDP_OLE_INIT_FAILED); return FALSE; } AfxEnableControlContainer(); EnableTaskbarInteraction(); // 使用 RichEdit 控件需要 AfxInitRichEdit2() // AfxInitRichEdit2(); // 标准初始化 // 如果未使用这些功能并希望减小 // 最终可执行文件的大小,则应移除下列 // 不需要的特定初始化例程 // 更改用于存储设置的注册表项 // TODO: 应适当修改该字符串, // 例如修改为公司或组织名 SetRegistryKey(_T("ATRADE_V1.0")); LoadStdProfileSettings(4); // 加载标准 INI 文件选项(包括 MRU) GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL); // 初始化配置信息 CConfig::Inst(); CLoginDlg dlg; if ( dlg.DoModal() != IDOK) { return 0; } InitContextMenuManager(); InitKeyboardManager(); InitTooltipManager(); CMFCToolTipInfo ttParams; ttParams.m_bVislManagerTheme = TRUE; theApp.GetTooltipManager()->SetTooltipParams(AFX_TOOLTIP_TYPE_ALL, RUNTIME_CLASS(CMFCToolTipCtrl), &ttParams); // 注册应用程序的文档模板。 文档模板 // 将用作文档、框架窗口和视图之间的连接 // CMultiDocTemplate* pDocTemplate; // pDocTemplate = new CMultiDocTemplate(IDR_ATradeTYPE, // RUNTIME_CLASS(CATradeDoc), // RUNTIME_CLASS(CChildFrame), // 自定义 MDI 子框架 // RUNTIME_CLASS(CATradeView)); // if (!pDocTemplate) // return FALSE; // AddDocTemplate(pDocTemplate); CMainDlg mainDlg; mainDlg.DoModal(); // 创建主 MDI 框架窗口 // CMainFrame* pMainFrame = new CMainFrame; // if (!pMainFrame || !pMainFrame->LoadFrame(IDR_MAINFRAME)) // { // delete pMainFrame; // return FALSE; // } // m_pMainWnd = pMainFrame; // 分析标准 shell 命令、DDE、打开文件操作的命令行 // CCommandLineInfo cmdInfo; // ParseCommandLine(cmdInfo); // // // // // 调度在命令行中指定的命令。 如果 // // 用 /RegServer、/Register、/Unregserver 或 /Unregister 启动应用程序,则返回 FALSE。 // if (!ProcessShellCommand(cmdInfo)) // return FALSE; // 主窗口已初始化,因此显示它并对其进行更新 // pMainFrame->ShowWindow(m_nCmdShow); // pMainFrame->UpdateWindow(); return TRUE; }
BOOL CUAVSoftApp::InitInstance() { // 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(); // Initialize OLE libraries if (!AfxOleInit()) { AfxMessageBox(IDP_OLE_INIT_FAILED); return FALSE; } AfxEnableControlContainer(); globalData.SetDPIAware (); // 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 // TODO: You should modify this string to be something appropriate // such as the name of your company or organization SetRegistryKey(_T("BCGP AppWizard-Generated Applications")); LoadStdProfileSettings(4); // Load standard INI file options (including MRU) SetRegistryBase (_T("Settings")); // Initialize all Managers for usage. They are automatically constructed // if not yet present InitContextMenuManager(); InitKeyboardManager(); // TODO: Remove this if you don't want extended tooltips: InitTooltipManager(); CBCGPToolTipParams params; params.m_bVislManagerTheme = TRUE; theApp.GetTooltipManager ()->SetTooltipParams ( BCGP_TOOLTIP_TYPE_ALL, RUNTIME_CLASS (CBCGPToolTipCtrl), ¶ms); // 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(CUAVSoftDoc), RUNTIME_CLASS(CMainFrame), // main SDI frame window RUNTIME_CLASS(CUAVSoftView)); if (!pDocTemplate) return FALSE; AddDocTemplate(pDocTemplate); // Parse command line for standard shell commands, DDE, file open CCommandLineInfo cmdInfo; ParseCommandLine(cmdInfo); // Dispatch commands specified on the command line if (!ProcessShellCommand(cmdInfo)) return FALSE; //设置文档连接地图管理控件 CMainFrame *pMainFrame = (CMainFrame *)AfxGetMainWnd(); CUAVSoftDoc *pDoc =dynamic_cast<CUAVSoftDoc*>(pMainFrame->GetActiveDocument()); pDoc->SetLinkMapTree(pMainFrame->GetTOC()); pMainFrame->GetTOC()->RefreshFromDoc(); POSITION pos=pDoc->GetFirstViewPosition(); CUAVSoftView* pView=(CUAVSoftView*)pDoc->GetNextView(pos); pView->SetStatusControl(); m_pMainWnd->SetWindowText("无人机数据处理系统");//无人机数据处理系统 // The one and only window has been initialized, so show and update it m_pMainWnd->ShowWindow(SW_SHOWMAXIMIZED); m_pMainWnd->UpdateWindow(); // call DragAcceptFiles only if there's a suffix // In an SDI app, this should occur after ProcessShellCommand return TRUE; }
BOOL CReClass2015App::InitInstance() { INITCOMMONCONTROLSEX InitCtrls; InitCtrls.dwSize = sizeof(InitCtrls); InitCtrls.dwICC = ICC_STANDARD_CLASSES; InitCommonControlsEx(&InitCtrls); CWinAppEx::InitInstance(); if (!AfxOleInit()) { AfxMessageBox(IDP_OLE_INIT_FAILED); return FALSE; } AfxEnableControlContainer(); SetRegistryKey(_T("ReClass 2015")); EnableTaskbarInteraction(FALSE); InitContextMenuManager(); InitKeyboardManager(); InitTooltipManager(); CMFCToolTipInfo ttParams; ttParams.m_bVislManagerTheme = TRUE; theApp.GetTooltipManager()->SetTooltipParams(AFX_TOOLTIP_TYPE_ALL, RUNTIME_CLASS(CMFCToolTipCtrl), &ttParams); crBackground = GetProfileInt("Colors", "crBackground", crBackground); crSelect = GetProfileInt("Colors", "crSelect", crSelect); crHidden = GetProfileInt("Colors", "crHidden", crHidden); crOffset = GetProfileInt("Colors", "crOffset", crOffset); crAddress = GetProfileInt("Colors", "crAddress", crAddress); crType = GetProfileInt("Colors", "crType", crType); crName = GetProfileInt("Colors", "crName", crName); crIndex = GetProfileInt("Colors", "crIndex", crIndex); crValue = GetProfileInt("Colors", "crValue", crValue); crComment = GetProfileInt("Colors", "crComment", crComment); crVTable = GetProfileInt("Colors", "crVTable", crVTable); crFunction = GetProfileInt("Colors", "crFunction", crFunction); crChar = GetProfileInt("Colors", "crChar", crChar); crCustom = GetProfileInt("Colors", "crCustom", crCustom); crHex = GetProfileInt("Colors", "crHex", crHex); gbOffset = GetProfileInt("Display", "gbOffset", gbOffset) > 0 ? true : false; gbAddress = GetProfileInt("Display", "gbAddress", gbAddress) > 0 ? true : false; gbText = GetProfileInt("Display", "gbText", gbText) > 0 ? true : false; gbFloat = GetProfileInt("Display", "gbFloat", gbFloat) > 0 ? true : false; gbInt = GetProfileInt("Display", "gbInt", gbInt) > 0 ? true : false; gbString = GetProfileInt("Display", "gbString", gbString) > 0 ? true : false; gbPointers = GetProfileInt("Display", "gbPointers", gbPointers) > 0 ? true : false; gbClassBrowser = GetProfileInt("Display", "gbClassBrowser", gbClassBrowser) > 0 ? true : false; gbFilterProcesses = GetProfileInt("Display", "gbFilterProcesses", gbFilterProcesses) > 0 ? true : false; // make toggle gbTop = false; //GetProfileInt("Display","gbTop",gbTop) > 0 ? true : false; CMDIFrameWnd* pFrame = new CMainFrame(); m_pMainWnd = pFrame; if(!pFrame) return FALSE; if (!pFrame->LoadFrame(IDR_MAINFRAME)) return FALSE; HINSTANCE hInst = AfxGetResourceHandle(); m_hMDIMenu = ::LoadMenu(hInst, MAKEINTRESOURCE(IDR_ReClass2015TYPE)); m_hMDIAccel = ::LoadAccelerators(hInst, MAKEINTRESOURCE(IDR_ReClass2015TYPE)); HICON icon; icon = ::LoadIcon(hInst, MAKEINTRESOURCE(IDI_ICON_OPEN)); Icons.push_back(icon); icon = ::LoadIcon(hInst, MAKEINTRESOURCE(IDI_ICON_CLOSED)); Icons.push_back(icon); icon = ::LoadIcon(hInst, MAKEINTRESOURCE(IDI_ICON_CLASS)); Icons.push_back(icon); icon = ::LoadIcon(hInst, MAKEINTRESOURCE(IDI_ICON_METHOD)); Icons.push_back(icon); icon = ::LoadIcon(hInst, MAKEINTRESOURCE(IDI_ICON_VTABLE)); Icons.push_back(icon); icon = ::LoadIcon(hInst, MAKEINTRESOURCE(IDI_ICON_DELETE)); Icons.push_back(icon); icon = ::LoadIcon(hInst, MAKEINTRESOURCE(IDI_ICON_ADD)); Icons.push_back(icon); icon = ::LoadIcon(hInst, MAKEINTRESOURCE(IDI_ICON_RANDOM)); Icons.push_back(icon); icon = ::LoadIcon(hInst, MAKEINTRESOURCE(IDI_ICON_DROPARROW)); Icons.push_back(icon); icon = ::LoadIcon(hInst, MAKEINTRESOURCE(IDI_ICON_POINTER)); Icons.push_back(icon); icon = ::LoadIcon(hInst, MAKEINTRESOURCE(IDI_ICON_ARRAY)); Icons.push_back(icon); icon = ::LoadIcon(hInst, MAKEINTRESOURCE(IDI_ICON_CUSTOM)); Icons.push_back(icon); icon = ::LoadIcon(hInst, MAKEINTRESOURCE(IDI_ICON_ENUM)); Icons.push_back(icon); icon = ::LoadIcon(hInst, MAKEINTRESOURCE(IDI_ICON_FLOAT)); Icons.push_back(icon); icon = ::LoadIcon(hInst, MAKEINTRESOURCE(IDI_ICON_LEFT)); Icons.push_back(icon); icon = ::LoadIcon(hInst, MAKEINTRESOURCE(IDI_ICON_RIGHT)); Icons.push_back(icon); icon = ::LoadIcon(hInst, MAKEINTRESOURCE(IDI_ICON_MATRIX)); Icons.push_back(icon); icon = ::LoadIcon(hInst, MAKEINTRESOURCE(IDI_ICON_INTEGER)); Icons.push_back(icon); icon = ::LoadIcon(hInst, MAKEINTRESOURCE(IDI_ICON_TEXT)); Icons.push_back(icon); icon = ::LoadIcon(hInst, MAKEINTRESOURCE(IDI_ICON_UNSIGNED)); Icons.push_back(icon); icon = ::LoadIcon(hInst, MAKEINTRESOURCE(IDI_ICON_VECTOR)); Icons.push_back(icon); icon = ::LoadIcon(hInst, MAKEINTRESOURCE(IDI_ICON_CHANGE)); Icons.push_back(icon); icon = ::LoadIcon(hInst, MAKEINTRESOURCE(IDI_ICON_CAMERA)); Icons.push_back(icon); //Font.CreatePointFont(80,"Terminal"); ////Font.CreateFont(16, 8, 0, 0, FW_NORMAL,FALSE, FALSE, FALSE, 0, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, FIXED_PITCH, "Terminal"); //FontWidth = 16; //FontHeight = 16; //FontWidth = 8; //FontHeight = 8; Font.CreateFont(16, 8, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, 0, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, FIXED_PITCH, "Terminal"); FontWidth = 8; FontHeight = 14; //FontWidth = 8; //FontHeight = 16; //Font.CreateFont(FontHeight, FontWidth, 0, 0, FW_NORMAL,FALSE, FALSE, FALSE, 0, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, FIXED_PITCH, "Fixedsys"); //FontHeight = 14; //SmallFont.CreateFont(12, 8, 0, 0, FW_NORMAL,FALSE, FALSE, FALSE, 0, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, FIXED_PITCH, "Terminal"); //UpdateMemoryMap(); //UpdateExports(); // Initialize the editor if (!Scintilla_RegisterClasses(AfxGetApp()->m_hInstance)) { AfxMessageBox("Scintilla failed to initiailze"); return FALSE; } pFrame->ShowWindow(m_nCmdShow); pFrame->UpdateWindow(); getDebugPriv(); return TRUE; }
BOOL CDanmoojiPaintApp::InitInstance() { CWinAppEx::InitInstance(); GdiplusStartupInput gdiplusStartupInput; // GDI+를 위한 환경설정 GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL); EnableTaskbarInteraction(); // RichEdit 컨트롤을 사용하려면 AfxInitRichEdipointer_aft()가 있어야 합니다. // AfxInitRichEdipointer_aft(); // RichEdit 컨트롤을 사용하려면 AfxInitRichEdit2()가 있어야 합니다. // AfxInitRichEdit2(); // 표준 초기화 // 이들 기능을 사용하지 않고 최종 실행 파일의 크기를 줄이려면 // 아래에서 필요 없는 특정 초기화 // 루틴을 제거해야 합니다. // 해당 설정이 저장된 레지스트리 키를 변경하십시오. // TODO: 이 문자열을 회사 또는 조직의 이름과 같은 // 적절한 내용으로 수정해야 합니다. SetRegistryKey(_T("로컬 응용 프로그램 마법사에서 생성된 응용 프로그램")); LoadStdProfileSettings(4); // MRU를 포함하여 표준 INI 파일 옵션을 로드합니다. InitContextMenuManager(); InitKeyboardManager(); InitTooltipManager(); CMFCToolTipInfo ttParams; ttParams.m_bVislManagerTheme = TRUE; theApp.GetTooltipManager()->SetTooltipParams(AFX_TOOLTIP_TYPE_ALL, RUNTIME_CLASS(CMFCToolTipCtrl), &ttParams); // 응용 프로그램의 문서 템플릿을 등록합니다. 문서 템플릿은 // 문서, 프레임 창 및 뷰 사이의 연결 역할을 합니다. CMultiDocTemplate* pDocTemplate; pDocTemplate = new CMultiDocTemplate(IDR_DanmoojiPaintTYPE, RUNTIME_CLASS(CDanmoojiPaintDoc), RUNTIME_CLASS(CChildFrame), // 사용자 지정 MDI 자식 프레임입니다. RUNTIME_CLASS(CDanmoojiPaintView)); if (!pDocTemplate) return FALSE; AddDocTemplate(pDocTemplate); // 주 MDI 프레임 창을 만듭니다. CMainFrame* pMainFrame = new CMainFrame; if (!pMainFrame || !pMainFrame->LoadFrame(IDR_MAINFRAME)) { delete pMainFrame; return FALSE; } m_pMainWnd = pMainFrame; // 표준 셸 명령, DDE, 파일 열기에 대한 명령줄을 구문 분석합니다. CCommandLineInfo cmdInfo; ParseCommandLine(cmdInfo); // 명령줄에 지정된 명령을 디스패치합니다. // 응용 프로그램이 /RegServer, /Register, /Unregserver 또는 /Unregister로 시작된 경우 FALSE를 반환합니다. if (!ProcessShellCommand(cmdInfo)) return FALSE; // 주 창이 초기화되었으므로 이를 표시하고 업데이트합니다. pMainFrame->ShowWindow(m_nCmdShow); pMainFrame->UpdateWindow(); m_pMainWnd->DragAcceptFiles(); return TRUE; }
BOOL CSketcherApp::InitInstance() { CWinAppEx::InitInstance(); EnableTaskbarInteraction(FALSE); // AfxInitRichEdit2() is required to use RichEdit control // AfxInitRichEdit2(); // 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 // TODO: You should modify this string to be something appropriate // such as the name of your company or organization SetRegistryKey(_T("Local AppWizard-Generated Applications")); LoadStdProfileSettings(4); // Load standard INI file options (including MRU) InitContextMenuManager(); InitKeyboardManager(); InitTooltipManager(); CMFCToolTipInfo ttParams; ttParams.m_bVislManagerTheme = TRUE; theApp.GetTooltipManager()->SetTooltipParams(AFX_TOOLTIP_TYPE_ALL, RUNTIME_CLASS(CMFCToolTipCtrl), &ttParams); // Register the application's document templates. Document templates // serve as the connection between documents, frame windows and views CMultiDocTemplate* pDocTemplate; pDocTemplate = new CMultiDocTemplate(IDR_SketchTYPE, RUNTIME_CLASS(CSketcherDoc), RUNTIME_CLASS(CChildFrame), // custom MDI child frame RUNTIME_CLASS(CSketcherView)); if (!pDocTemplate) return FALSE; AddDocTemplate(pDocTemplate); // create main MDI Frame window CMainFrame* pMainFrame = new CMainFrame; if (!pMainFrame || !pMainFrame->LoadFrame(IDR_MAINFRAME)) { delete pMainFrame; return FALSE; } m_pMainWnd = pMainFrame; // call DragAcceptFiles only if there's a suffix // In an MDI app, this should occur immediately after setting m_pMainWnd // Enable drag/drop open m_pMainWnd->DragAcceptFiles(); // Parse command line for standard shell commands, DDE, file open CCommandLineInfo cmdInfo; ParseCommandLine(cmdInfo); // Enable DDE Execute open EnableShellOpen(); RegisterShellFileTypes(TRUE); // 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; // The main window has been initialized, so show and update it pMainFrame->ShowWindow(m_nCmdShow); pMainFrame->UpdateWindow(); return TRUE; }
BOOL CGPEngineApp::InitInstance() { // Windows XP requiere InitCommonControlsEx() si un manifiesto de // aplicación especifica el uso de ComCtl32.dll versión 6 o posterior para habilitar // estilos visuales. De lo contrario, se generará un error al crear ventanas. INITCOMMONCONTROLSEX InitCtrls; InitCtrls.dwSize = sizeof(InitCtrls); // Establecer para incluir todas las clases de control comunes que desee utilizar // en la aplicación. InitCtrls.dwICC = ICC_WIN95_CLASSES; InitCommonControlsEx(&InitCtrls); CWinAppEx::InitInstance(); EnableTaskbarInteraction(FALSE); // Se necesita AfxInitRichEdit2() para usar el control RichEdit // AfxInitRichEdit2(); // Inicialización estándar // Si no utiliza estas características y desea reducir el tamaño // del archivo ejecutable final, debe quitar // las rutinas de inicialización específicas que no necesite // Cambie la clave del Registro en la que se almacena la configuración // TODO: debe modificar esta cadena para que contenga información correcta // como el nombre de su compañía u organización SetRegistryKey(_T("Aplicaciones generadas con el Asistente para aplicaciones local")); LoadStdProfileSettings(4); // Cargar opciones de archivo INI estándar (incluidas las de la lista MRU) InitContextMenuManager(); InitKeyboardManager(); InitTooltipManager(); CMFCToolTipInfo ttParams; ttParams.m_bVislManagerTheme = TRUE; theApp.GetTooltipManager()->SetTooltipParams(AFX_TOOLTIP_TYPE_ALL, RUNTIME_CLASS(CMFCToolTipCtrl), &ttParams); // Registrar las plantillas de documento de la aplicación. Las plantillas de documento // sirven como conexión entre documentos, ventanas de marco y vistas CSingleDocTemplate* pDocTemplate; pDocTemplate = new CSingleDocTemplate( IDR_MAINFRAME, RUNTIME_CLASS(CGPEngineDoc), RUNTIME_CLASS(CMainFrame), // Ventana de marco SDI principal RUNTIME_CLASS(CGPEngineView)); if (!pDocTemplate) return FALSE; AddDocTemplate(pDocTemplate); // Analizar línea de comandos para comandos Shell estándar, DDE, Archivo Abrir CCommandLineInfo cmdInfo; ParseCommandLine(cmdInfo); // Habilitar apertura de ejecución DDE EnableShellOpen(); RegisterShellFileTypes(TRUE); // Enviar comandos especificados en la línea de comandos. Devolverá FALSE si // la aplicación se inició con los modificadores /RegServer, /Register, /Unregserver o /Unregister. if (!ProcessShellCommand(cmdInfo)) return FALSE; if(_engine_view!=NULL) _engine_view->init = true; // Se ha inicializado la única ventana; mostrarla y actualizarla m_pMainWnd->ShowWindow(SW_SHOWMAXIMIZED); m_pMainWnd->UpdateWindow(); // Llamar a DragAcceptFiles sólo si existe un sufijo // En una aplicación SDI, esto debe ocurrir después de ProcessShellCommand // Habilitar apertura de arrastrar y colocar m_pMainWnd->DragAcceptFiles(); return TRUE; }
BOOL Cp08showcursorPosApp::InitInstance() { // 응용 프로그램 매니페스트가 ComCtl32.dll 버전 6 이상을 사용하여 비주얼 스타일을 // 사용하도록 지정하는 경우, Windows XP 상에서 반드시 InitCommonControlsEx()가 필요합니다. // InitCommonControlsEx()를 사용하지 않으면 창을 만들 수 없습니다. INITCOMMONCONTROLSEX InitCtrls; InitCtrls.dwSize = sizeof(InitCtrls); // 응용 프로그램에서 사용할 모든 공용 컨트롤 클래스를 포함하도록 // 이 항목을 설정하십시오. InitCtrls.dwICC = ICC_WIN95_CLASSES; InitCommonControlsEx(&InitCtrls); CWinAppEx::InitInstance(); // OLE 라이브러리를 초기화합니다. if (!AfxOleInit()) { AfxMessageBox(IDP_OLE_INIT_FAILED); return FALSE; } AfxEnableControlContainer(); EnableTaskbarInteraction(FALSE); // RichEdit 컨트롤을 사용하려면 AfxInitRichEdit2()가 있어야 합니다. // AfxInitRichEdit2(); // 표준 초기화 // 이들 기능을 사용하지 않고 최종 실행 파일의 크기를 줄이려면 // 아래에서 필요 없는 특정 초기화 // 루틴을 제거해야 합니다. // 해당 설정이 저장된 레지스트리 키를 변경하십시오. // TODO: 이 문자열을 회사 또는 조직의 이름과 같은 // 적절한 내용으로 수정해야 합니다. SetRegistryKey(_T("로컬 응용 프로그램 마법사에서 생성된 응용 프로그램")); LoadStdProfileSettings(4); // MRU를 포함하여 표준 INI 파일 옵션을 로드합니다. InitContextMenuManager(); InitKeyboardManager(); InitTooltipManager(); CMFCToolTipInfo ttParams; ttParams.m_bVislManagerTheme = TRUE; theApp.GetTooltipManager()->SetTooltipParams(AFX_TOOLTIP_TYPE_ALL, RUNTIME_CLASS(CMFCToolTipCtrl), &ttParams); // 응용 프로그램의 문서 템플릿을 등록합니다. 문서 템플릿은 // 문서, 프레임 창 및 뷰 사이의 연결 역할을 합니다. CSingleDocTemplate* pDocTemplate; pDocTemplate = new CSingleDocTemplate( IDR_MAINFRAME, RUNTIME_CLASS(Cp08showcursorPosDoc), RUNTIME_CLASS(CMainFrame), // 주 SDI 프레임 창입니다. RUNTIME_CLASS(Cp08showcursorPosView)); if (!pDocTemplate) return FALSE; AddDocTemplate(pDocTemplate); // 표준 셸 명령, DDE, 파일 열기에 대한 명령줄을 구문 분석합니다. CCommandLineInfo cmdInfo; ParseCommandLine(cmdInfo); // 명령줄에 지정된 명령을 디스패치합니다. // 응용 프로그램이 /RegServer, /Register, /Unregserver 또는 /Unregister로 시작된 경우 FALSE를 반환합니다. if (!ProcessShellCommand(cmdInfo)) return FALSE; // 창 하나만 초기화되었으므로 이를 표시하고 업데이트합니다. m_pMainWnd->ShowWindow(SW_SHOW); m_pMainWnd->UpdateWindow(); // 접미사가 있을 경우에만 DragAcceptFiles를 호출합니다. // SDI 응용 프로그램에서는 ProcessShellCommand 후에 이러한 호출이 발생해야 합니다. return TRUE; }
BOOL CBCGPIE7DemoApp::InitInstance() { // Initialize OLE libraries if (!AfxOleInit()) { AfxMessageBox(IDP_OLE_INIT_FAILED); return FALSE; } AfxEnableControlContainer(); AfxInitRichEdit (); // 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. #if _MSC_VER < 1400 #ifdef _AFXDLL Enable3dControls(); // Call this when using MFC in a shared DLL #else Enable3dControlsStatic(); // Call this when linking to MFC statically #endif #endif // Change the registry key under which our settings are stored. // TODO: You should modify this string to be something appropriate // such as the name of your company or organization. SetRegistryKey(_T("BCGSoft\\BCGControlBarPro\\Examples")); LoadStdProfileSettings(0); // Load standard INI file options (including MRU) SetRegistryBase (_T("Settings")); // Initialize all Managers for usage. They are automatically constructed // if not yet present InitKeyboardManager(); // TODO: Remove this if you don't want extended tooltips: InitTooltipManager(); CBCGPToolTipParams params; params.m_bVislManagerTheme = TRUE; theApp.GetTooltipManager ()->SetTooltipParams ( BCGP_TOOLTIP_TYPE_ALL, RUNTIME_CLASS (CBCGPToolTipCtrl), ¶ms); m_Favorites.Load (); m_bLargeIcons = (BOOL)GetProfileInt (_T("Options"), _T("LargeIcons"), (int)m_bLargeIcons); // Register the application's document templates. Document templates // serve as the connection between documents, frame windows and views. CMultiDocTemplate* pDocTemplate; pDocTemplate = new CMultiDocTemplate( IDR_BCGPIETYPE, RUNTIME_CLASS(CBCGPIE7DemoDoc), RUNTIME_CLASS(CChildFrame), // custom MDI child frame RUNTIME_CLASS(CBCGPIE7DemoView)); AddDocTemplate(pDocTemplate); m_Style = (globalData.DwmIsCompositionEnabled ()) ? 2 : 1; // create main MDI Frame window CMainFrame* pMainFrame = new CMainFrame; if (!pMainFrame->LoadFrame(IDR_MAINFRAME)) return FALSE; m_pMainWnd = pMainFrame; // Parse command line for standard shell commands, DDE, file open CCommandLineInfo cmdInfo; ParseCommandLine(cmdInfo); if (!ProcessShellCommand(cmdInfo)) return FALSE; // The main window has been initialized, so show and update it. pMainFrame->ShowWindow(m_nCmdShow); pMainFrame->UpdateWindow(); return TRUE; }
BOOL CMFCTemplateApp::InitInstance() { // 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); CWinAppEx::InitInstance(); // Initialize OLE libraries if (!AfxOleInit()) { AfxMessageBox(IDP_OLE_INIT_FAILED); return FALSE; } AfxEnableControlContainer(); EnableTaskbarInteraction(FALSE); // AfxInitRichEdit2() is required to use RichEdit control // AfxInitRichEdit2(); // 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 // TODO: You should modify this string to be something appropriate // such as the name of your company or organization SetRegistryKey(_T("Local AppWizard-Generated Applications")); LoadStdProfileSettings(4); // Load standard INI file options (including MRU) InitContextMenuManager(); InitKeyboardManager(); InitTooltipManager(); CMFCToolTipInfo ttParams; ttParams.m_bVislManagerTheme = TRUE; theApp.GetTooltipManager()->SetTooltipParams(AFX_TOOLTIP_TYPE_ALL, RUNTIME_CLASS(CMFCToolTipCtrl), &ttParams); // 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(CMFCTemplateDoc), RUNTIME_CLASS(CMainFrame), // main SDI frame window RUNTIME_CLASS(CMFCTemplateView)); if (!pDocTemplate) return FALSE; AddDocTemplate(pDocTemplate); // Parse command line for standard shell commands, DDE, file open CCommandLineInfo cmdInfo; ParseCommandLine(cmdInfo); // 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; // The one and only window has been initialized, so show and update it 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 return TRUE; }
BOOL CBCGPGanttDemoApp::InitInstance() { // Initialize OLE libraries if (!AfxOleInit()) { AfxMessageBox(IDP_OLE_INIT_FAILED); return FALSE; } AfxEnableControlContainer(); // Change the registry key under which our settings are stored. // TODO: You should modify this string to be something appropriate // such as the name of your company or organization. #ifndef _BCGPGANTT_STANDALONE SetRegistryKey(_T("BCGSoft\\BCGControlBarPro\\Examples")); #else SetRegistryKey(_T("BCGSoft\\BCGGantt\\Samples")); #endif LoadStdProfileSettings(); // Load standard INI file options (including MRU) #ifndef _BCGPGANTT_STANDALONE SetRegistryBase (_T("Settings")); #endif #ifndef _BCGPGANTT_STANDALONE // Initialize all Managers for usage. They are automatically constructed // if not yet present InitContextMenuManager(); InitKeyboardManager(); InitTooltipManager(); CBCGPToolTipParams params; params.m_bVislManagerTheme = TRUE; globalData.m_nMaxToolTipWidth = 150; GetTooltipManager ()->SetTooltipParams ( 0xFFFF, RUNTIME_CLASS (CBCGPToolTipCtrl), ¶ms); #endif // 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(CBCGPGanttDemoDoc), RUNTIME_CLASS(CMainFrame), // main SDI frame window RUNTIME_CLASS(CBCGPGanttDemoView)); AddDocTemplate(pDocTemplate); // Parse command line for standard shell commands, DDE, file open CCommandLineInfo cmdInfo; ParseCommandLine(cmdInfo); // Dispatch commands specified on the command line if (!ProcessShellCommand(cmdInfo)) return FALSE; // The one and only window has been initialized, so show and update it. m_pMainWnd->ShowWindow(SW_SHOW); m_pMainWnd->UpdateWindow(); return TRUE; }
BOOL CTest2App::InitInstance() { // 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(); if (!AfxSocketInit()) { AfxMessageBox(IDP_SOCKETS_INIT_FAILED); return FALSE; } // Initialize OLE libraries if (!AfxOleInit()) { AfxMessageBox(IDP_OLE_INIT_FAILED); return FALSE; } AfxEnableControlContainer(); globalData.SetDPIAware (); // 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 // TODO: You should modify this string to be something appropriate // such as the name of your company or organization SetRegistryKey(_T("BCGP AppWizard-Generated Applications")); LoadStdProfileSettings(4); // Load standard INI file options (including MRU) SetRegistryBase (_T("Settings")); // Initialize all Managers for usage. They are automatically constructed // if not yet present InitContextMenuManager(); InitKeyboardManager(); // TODO: Remove this if you don't want extended tooltips: InitTooltipManager(); CBCGPToolTipParams params; params.m_bVislManagerTheme = TRUE; theApp.GetTooltipManager ()->SetTooltipParams ( BCGP_TOOLTIP_TYPE_ALL, RUNTIME_CLASS (CBCGPToolTipCtrl), ¶ms); // Register the application's document templates. Document templates // serve as the connection between documents, frame windows and views CMultiDocTemplate* pDocTemplate; pDocTemplate = new CMultiDocTemplate(IDR_Test2TYPE, RUNTIME_CLASS(CTest2Doc), RUNTIME_CLASS(CChildFrame), // custom MDI child frame RUNTIME_CLASS(CTest2View)); if (!pDocTemplate) return FALSE; AddDocTemplate(pDocTemplate); // create main MDI Frame window CMainFrame* pMainFrame = new CMainFrame; if (!pMainFrame->LoadFrame(IDR_MAINFRAME)) return FALSE; m_pMainWnd = pMainFrame; // call DragAcceptFiles only if there's a suffix // In an MDI app, this should occur immediately after setting m_pMainWnd // Parse command line for standard shell commands, DDE, file open CCommandLineInfo cmdInfo; ParseCommandLine(cmdInfo); if (cmdInfo.m_nShellCommand == CCommandLineInfo::FileNew) { if (!pMainFrame->LoadMDIState (GetRegSectionPath ())) { if (!ProcessShellCommand(cmdInfo)) return FALSE; } } else { // Dispatch commands specified on the command line if (!ProcessShellCommand(cmdInfo)) return FALSE; } // The main window has been initialized, so show and update it pMainFrame->ShowWindow(m_nCmdShow); pMainFrame->UpdateWindow(); return TRUE; }
BOOL CPicConvertApp::InitInstance() { // 如果一个运行在 Windows XP 上的应用程序清单指定要 // 使用 ComCtl32.dll 版本 6 或更高版本来启用可视化方式, //则需要 InitCommonControlsEx()。否则,将无法创建窗口。 INITCOMMONCONTROLSEX InitCtrls; InitCtrls.dwSize = sizeof(InitCtrls); // 将它设置为包括所有要在应用程序中使用的 // 公共控件类。 InitCtrls.dwICC = ICC_WIN95_CLASSES; InitCommonControlsEx(&InitCtrls); CWinAppEx::InitInstance(); // 初始化 OLE 库 if (!AfxOleInit()) { AfxMessageBox(IDP_OLE_INIT_FAILED); return FALSE; } AfxEnableControlContainer(); EnableTaskbarInteraction(FALSE); // 使用 RichEdit 控件需要 AfxInitRichEdit2() // AfxInitRichEdit2(); // 标准初始化 // 如果未使用这些功能并希望减小 // 最终可执行文件的大小,则应移除下列 // 不需要的特定初始化例程 // 更改用于存储设置的注册表项 // TODO: 应适当修改该字符串, // 例如修改为公司或组织名 SetRegistryKey(_T("应用程序向导生成的本地应用程序")); LoadStdProfileSettings(4); // 加载标准 INI 文件选项(包括 MRU) InitContextMenuManager(); InitKeyboardManager(); InitTooltipManager(); CMFCToolTipInfo ttParams; ttParams.m_bVislManagerTheme = TRUE; theApp.GetTooltipManager()->SetTooltipParams(AFX_TOOLTIP_TYPE_ALL, RUNTIME_CLASS(CMFCToolTipCtrl), &ttParams); // 注册应用程序的文档模板。文档模板 // 将用作文档、框架窗口和视图之间的连接 CSingleDocTemplate* pDocTemplate; pDocTemplate = new CSingleDocTemplate( IDR_MAINFRAME, RUNTIME_CLASS(CPicConvertDoc), RUNTIME_CLASS(CMainFrame), // 主 SDI 框架窗口 RUNTIME_CLASS(CPicConvertView)); if (!pDocTemplate) return FALSE; AddDocTemplate(pDocTemplate); // 分析标准 shell 命令、DDE、打开文件操作的命令行 CCommandLineInfo cmdInfo; ParseCommandLine(cmdInfo); // 调度在命令行中指定的命令。如果 // 用 /RegServer、/Register、/Unregserver 或 /Unregister 启动应用程序,则返回 FALSE。 if (!ProcessShellCommand(cmdInfo)) return FALSE; // 唯一的一个窗口已初始化,因此显示它并对其进行更新 m_pMainWnd->ShowWindow(SW_SHOW); m_pMainWnd->UpdateWindow(); // 仅当具有后缀时才调用 DragAcceptFiles // 在 SDI 应用程序中,这应在 ProcessShellCommand 之后发生 return TRUE; }
BOOL CUserApplicationApp::InitInstance() { m_app->OnInitialize(); // アプリケーション マニフェストが visual スタイルを有効にするために、 // ComCtl32.dll Version 6 以降の使用を指定する場合は、 // Windows XP に InitCommonControlsEx() が必要です。さもなければ、ウィンドウ作成はすべて失敗します。 INITCOMMONCONTROLSEX InitCtrls; InitCtrls.dwSize = sizeof(InitCtrls); // アプリケーションで使用するすべてのコモン コントロール クラスを含めるには、 // これを設定します。 InitCtrls.dwICC = ICC_WIN95_CLASSES; InitCommonControlsEx(&InitCtrls); CWinAppEx::InitInstance(); // OLE ライブラリを初期化します。 if (!AfxOleInit()) { AfxMessageBox(_T("OLE Init failed.")); return FALSE; } AfxEnableControlContainer(); EnableTaskbarInteraction(); // RichEdit コントロールを使用するには AfxInitRichEdit2() が必要です // AfxInitRichEdit2(); // 標準初期化 // これらの機能を使わずに最終的な実行可能ファイルの // サイズを縮小したい場合は、以下から不要な初期化 // ルーチンを削除してください。 // 設定が格納されているレジストリ キーを変更します。 // TODO: 会社名または組織名などの適切な文字列に // この文字列を変更してください。 SetRegistryKey(_T("アプリケーション ウィザードで生成されたローカル アプリケーション")); LoadStdProfileSettings(4); // 標準の INI ファイルのオプションをロードします (MRU を含む) InitContextMenuManager(); InitKeyboardManager(); InitTooltipManager(); CMFCToolTipInfo ttParams; ttParams.m_bVislManagerTheme = TRUE; //theApp.GetTooltipManager()->SetTooltipParams(AFX_TOOLTIP_TYPE_ALL, // RUNTIME_CLASS(CMFCToolTipCtrl), &ttParams); //// アプリケーション用のドキュメント テンプレートを登録します。ドキュメント テンプレート //// はドキュメント、フレーム ウィンドウとビューを結合するために機能します。 //CMultiDocTemplate* pDocTemplate; //pDocTemplate = new CMultiDocTemplate(IDR_UserApplicationTYPE, // RUNTIME_CLASS(CUserApplicationDoc), // RUNTIME_CLASS(CChildFrame), // カスタム MDI 子フレーム // RUNTIME_CLASS(CUserApplicationView)); //if (!pDocTemplate) // return FALSE; //AddDocTemplate(pDocTemplate); //// メイン MDI フレーム ウィンドウを作成します。 //CMainFrame* pMainFrame = new CMainFrame; //if (!pMainFrame || !pMainFrame->LoadFrame(IDR_MAINFRAME)) //{ // delete pMainFrame; // return FALSE; //} //m_pMainWnd = pMainFrame; // DDE、file open など標準のシェル コマンドのコマンド ラインを解析します。 CCommandLineInfo cmdInfo; ParseCommandLine(cmdInfo); // コマンド ラインで指定されたディスパッチ コマンドです。アプリケーションが // /RegServer、/Register、/Unregserver または /Unregister で起動された場合、False を返します。 if (!ProcessShellCommand(cmdInfo)) return FALSE; // メイン ウィンドウが初期化されたので、表示と更新を行います。 //pMainFrame->ShowWindow(m_nCmdShow); //pMainFrame->UpdateWindow(); return TRUE; }
BOOL CXiYuanApp::InitInstance() { // 如果一个运行在 Windows XP 上的应用程序清单指定要 // 使用 ComCtl32.dll 版本 6 或更高版本来启用可视化方式, //则需要 InitCommonControlsEx()。 否则,将无法创建窗口。 INITCOMMONCONTROLSEX InitCtrls; InitCtrls.dwSize = sizeof(InitCtrls); // 将它设置为包括所有要在应用程序中使用的 // 公共控件类。 InitCtrls.dwICC = ICC_WIN95_CLASSES; InitCommonControlsEx(&InitCtrls); CWinAppEx::InitInstance(); if (!AfxSocketInit()) { AfxMessageBox(IDP_SOCKETS_INIT_FAILED); return FALSE; } // 初始化 OLE 库 if (!AfxOleInit()) { AfxMessageBox(IDP_OLE_INIT_FAILED); return FALSE; } AfxEnableControlContainer(); EnableTaskbarInteraction(); // 使用 RichEdit 控件需要 AfxInitRichEdit2() // AfxInitRichEdit2(); // 标准初始化 // 如果未使用这些功能并希望减小 // 最终可执行文件的大小,则应移除下列 // 不需要的特定初始化例程 // 更改用于存储设置的注册表项 // TODO: 应适当修改该字符串, // 例如修改为公司或组织名 SetRegistryKey(_T("应用程序向导生成的本地应用程序")); LoadStdProfileSettings(16); // 加载标准 INI 文件选项(包括 MRU) // GDI+ GdiplusStartupInput gdiplusStartupInput; GdiplusStartup(&m_gdiplusToken, &gdiplusStartupInput, NULL); InitContextMenuManager(); InitKeyboardManager(); InitTooltipManager(); CMFCToolTipInfo ttParams; ttParams.m_bVislManagerTheme = TRUE; theApp.GetTooltipManager()->SetTooltipParams(AFX_TOOLTIP_TYPE_ALL, RUNTIME_CLASS(CMFCToolTipCtrl), &ttParams); // 注册应用程序的文档模板。 文档模板 // 将用作文档、框架窗口和视图之间的连接 CMultiDocTemplate* pDocTemplate; pDocTemplate = new CMultiDocTemplate(IDR_XiYuanTYPE, RUNTIME_CLASS(CXiYuanDoc), RUNTIME_CLASS(CChildFrame), // 自定义 MDI 子框架 RUNTIME_CLASS(CXiYuanView)); if (!pDocTemplate) return FALSE; AddDocTemplate(pDocTemplate); // 将 COleTemplateServer 连接到文档模板 // COleTemplateServer 通过使用 // 文档模板中指定的信息来为请求 OLE 容器 // 创建新文档 m_server.ConnectTemplate(clsid, pDocTemplate, FALSE); // 将所有的 OLE 服务器工厂注册为正在运行。 这将启用 // OLE 库以从其他应用程序中创建对象 COleTemplateServer::RegisterAll(); // 注意: MDI 应用程序将注册所有的服务器对象,而不管 // 命令行上的 /Embedding 或 /Automation // 创建主 MDI 框架窗口 CMainFrame* pMainFrame = new CMainFrame; if (!pMainFrame || !pMainFrame->LoadFrame(IDR_MAINFRAME)) { delete pMainFrame; return FALSE; } m_pMainWnd = pMainFrame; // 分析标准 shell 命令、DDE、打开文件操作的命令行 CCommandLineInfo cmdInfo; ParseCommandLine(cmdInfo); // 应用程序是用 /Embedding 或 /Automation 开关启动的。 //使应用程序作为自动化服务器运行。 if (cmdInfo.m_bRunEmbedded || cmdInfo.m_bRunAutomated) { // 不显示主窗口 return TRUE; } // 使用 /Unregserver 或 /Unregister 开关启动应用程序。 注销 // 类型库。 其他注销操作在 ProcessShellCommand() 中发生。 else if (cmdInfo.m_nShellCommand == CCommandLineInfo::AppUnregister) { m_server.UpdateRegistry(OAT_DISPATCH_OBJECT, NULL, NULL, FALSE); AfxOleUnregisterTypeLib(_tlid, _wVerMajor, _wVerMinor); } // 应用程序是以独立方式或用其他开关(如 /Register // 或 /Regserver)启动的。 更新注册表项,包括类型库。 else { m_server.UpdateRegistry(OAT_DISPATCH_OBJECT); COleObjectFactory::UpdateRegistryAll(); AfxOleRegisterTypeLib(AfxGetInstanceHandle(), _tlid); } // 调度在命令行中指定的命令。 如果 // 用 /RegServer、/Register、/Unregserver 或 /Unregister 启动应用程序,则返回 FALSE。 if (!ProcessShellCommand(cmdInfo)) return FALSE; // 主窗口已初始化,因此显示它并对其进行更新 pMainFrame->ShowWindow(SW_SHOWMAXIMIZED); pMainFrame->UpdateWindow(); return TRUE; }
BOOL CCarpetControlApp::InitInstance() { // 如果一个运行在 Windows XP 上的应用程序清单指定要 // 使用 ComCtl32.dll 版本 6 或更高版本来启用可视化方式, //则需要 InitCommonControlsEx()。否则,将无法创建窗口。 INITCOMMONCONTROLSEX InitCtrls; InitCtrls.dwSize = sizeof(InitCtrls); // 将它设置为包括所有要在应用程序中使用的 // 公共控件类。 InitCtrls.dwICC = ICC_WIN95_CLASSES; InitCommonControlsEx(&InitCtrls); CWinAppEx::InitInstance(); // 初始化 OLE 库 if (!AfxOleInit()) { AfxMessageBox(IDP_OLE_INIT_FAILED); return FALSE; } AfxEnableControlContainer(); EnableTaskbarInteraction(); SetRegistryKey(_T("应用程序向导生成的本地应用程序")); LoadStdProfileSettings(4); // 加载标准 INI 文件选项(包括 MRU) InitContextMenuManager(); InitKeyboardManager(); InitTooltipManager(); CMFCToolTipInfo ttParams; ttParams.m_bVislManagerTheme = TRUE; theApp.GetTooltipManager()->SetTooltipParams(AFX_TOOLTIP_TYPE_ALL, RUNTIME_CLASS(CMFCToolTipCtrl), &ttParams); CMultiDocTemplate* pDocTemplate; pDocTemplate = new CMultiDocTemplate(IDS_PHRASEFRAMESTRING, RUNTIME_CLASS(CCarpetControlDoc), RUNTIME_CLASS(CChildFrame), // 自定义 MDI 子框架 RUNTIME_CLASS(CPhraseFrame)); if (!pDocTemplate) return FALSE; AddDocTemplate(pDocTemplate); CMainFrame* pMainFrame = new CMainFrame; if (!pMainFrame || !pMainFrame->LoadFrame(IDR_MAINFRAME)) { delete pMainFrame; return FALSE; } m_pMainWnd = pMainFrame; CCommandLineInfo cmdInfo; //cmdInfo.m_nShellCommand=CCommandLineInfo::FileNothing; ParseCommandLine(cmdInfo); if (!ProcessShellCommand(cmdInfo)) return FALSE; pMainFrame->ShowWindow(m_nCmdShow); pMainFrame->UpdateWindow(); return TRUE; }