int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE, PTSTR, int nShowCmd) { AtlInitCommonControls(ICC_WIN95_CLASSES); _Module.Init(NULL, hInstance); CMainFrame *frameWnd = new CMainFrame; if (!frameWnd->Create(NULL, NULL, PDBEXP_WNDCAPTION)) { delete frameWnd; return EXIT_FAILURE; } frameWnd->CenterWindow(); frameWnd->ShowWindow(nShowCmd); MSG msg; HACCEL hAccTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDR_ACCELERATOR)); while (GetMessage(&msg, NULL, 0, 0)) { if (0 == TranslateAccelerator(*frameWnd, hAccTable, &msg)) { TranslateMessage(&msg); DispatchMessage(&msg); } } _Module.Term(); return (int)msg.wParam; }
BOOL CTestUIApp::InitInstance() { // 如果一个运行在 Windows XP 上的应用程序清单指定要 // 使用 ComCtl32.dll 版本 6 或更高版本来启用可视化方式, //则需要 InitCommonControlsEx()。否则,将无法创建窗口。 INITCOMMONCONTROLSEX InitCtrls; InitCtrls.dwSize = sizeof(InitCtrls); // 将它设置为包括所有要在应用程序中使用的 // 公共控件类。 InitCtrls.dwICC = ICC_WIN95_CLASSES; InitCommonControlsEx(&InitCtrls); CWinApp::InitInstance(); AfxEnableControlContainer(); // 标准初始化 // 如果未使用这些功能并希望减小 // 最终可执行文件的大小,则应移除下列 // 不需要的特定初始化例程 // 更改用于存储设置的注册表项 // TODO: 应适当修改该字符串, // 例如修改为公司或组织名 SetRegistryKey(_T("应用程序向导生成的本地应用程序")); DuiLib::CPaintManagerUI::SetInstance(AfxGetInstanceHandle()); DuiLib::CPaintManagerUI::SetResourcePath(DuiLib::CPaintManagerUI::GetInstancePath()); CMainFrame* pFrame = new CMainFrame(); if( pFrame == NULL ) return 0; pFrame->Create(NULL, _T("这是一个最简单的测试用exe,修改test1.xml就可以看到效果"), UI_WNDSTYLE_DIALOG, WS_EX_WINDOWEDGE); pFrame->CenterWindow(); pFrame->ShowWindow(true); DuiLib::CPaintManagerUI::MessageLoop(); // CTestUIDlg dlg; // m_pMainWnd = &dlg; // INT_PTR nResponse = dlg.DoModal(); // if (nResponse == IDOK) // { // // TODO: 在此放置处理何时用 // // “确定”来关闭对话框的代码 // } // else if (nResponse == IDCANCEL) // { // // TODO: 在此放置处理何时用 // // “取消”来关闭对话框的代码 // } // 由于对话框已关闭,所以将返回 FALSE 以便退出应用程序, // 而不是启动应用程序的消息泵。 return FALSE; }
int Run(LPTSTR lpstrCmdLine=NULL,int nCmdShow=SW_SHOWDEFAULT) { char *Filename=NULL; int argc; WCHAR *wcCommandLine; LPWSTR *argw; wcCommandLine=GetCommandLineW(); argw=CommandLineToArgvW(wcCommandLine,&argc); if(argw && argc>1) { int BuffSize=WideCharToMultiByte(CP_ACP,WC_COMPOSITECHECK,argw[1],-1,NULL,0,NULL,NULL); if(BuffSize>0) { Filename=(char *)GlobalAlloc(LPTR,BuffSize); if(Filename) WideCharToMultiByte(CP_ACP,WC_COMPOSITECHECK,argw[1],BuffSize*sizeof(WCHAR),Filename,BuffSize,NULL,NULL); } } CMessageLoop theLoop; _Module.AddMessageLoop(&theLoop); CMainFrame wndMain; //size of window to create CRect rc=CRect(0,0,800,600); if(wndMain.CreateEx(NULL,rc) == NULL) { ATLTRACE(_T("Main window creation failed!\n")); return 0; } //center and show main window wndMain.CenterWindow(); wndMain.ShowWindow(nCmdShow); new CSplashWnd(IDB_SPLASH,3000,wndMain.m_hWnd); if(Filename) wndMain.SetDatabaseFilename(Filename); try { int nRet = theLoop.Run(); _Module.RemoveMessageLoop(); return nRet; } catch (...) { return false; } }
int Run(LPTSTR /*lpstrCmdLine*/ = NULL, int nCmdShow = SW_SHOWDEFAULT) { CMessageLoop theLoop; theApp.AddMessageLoop(&theLoop); CMainFrame wndMain; if(wndMain.CreateEx() == NULL) { ATLTRACE(_T("Main window creation failed!\n")); return 0; } wndMain.CenterWindow(); wndMain.ShowWindow(nCmdShow); int nRet = theLoop.Run(); theApp.RemoveMessageLoop(); return nRet; }
int Run(LPTSTR /*lpstrCmdLine*/ = NULL, int nCmdShow = SW_SHOWDEFAULT) { CMessageLoop theLoop; _Module.AddMessageLoop(&theLoop); CMainFrame wndMain; RECT windowSize = { 0,0,700,600 };//생성시 윈도우 사이즈 if(wndMain.CreateEx(nullptr,windowSize) == NULL) { ATLTRACE(_T("Main window creation failed!\n")); return 0; } wndMain.CenterWindow(); wndMain.ModifyStyle(WS_THICKFRAME,0); wndMain.ShowWindow(nCmdShow); int nRet = theLoop.Run(); _Module.RemoveMessageLoop(); return nRet; }
int Run(LPTSTR /*lpstrCmdLine*/ = NULL, int nCmdShow = SW_SHOWMAXIMIZED) { CMessageLoop theLoop; _Module.AddMessageLoop(&theLoop); CMainFrame wndMain; if(wndMain.CreateEx(NULL) == NULL) { ATLTRACE(_T("Main window creation failed!\n")); return 0; } // wndMain.CenterWindow(); // nCmdShow = SW_SHOWMAXIMIZED; wndMain.ShowWindow(nCmdShow); int nRet = theLoop.Run(); _Module.RemoveMessageLoop(); return nRet; }
int Run(LPTSTR = NULL, int nCmdShow = SW_SHOWDEFAULT) { CMessageLoop theLoop; _Module.AddMessageLoop(&theLoop); RECT rc = { 0, 0, 960, 677 }; CMainFrame wndMain; if (wndMain.CreateEx(NULL, rc) == NULL) { ATLTRACE(_T("Main window creation failed!\n")); return 0; } wndMain.CenterWindow(); wndMain.ShowWindow(nCmdShow); int nRet = theLoop.Run(); _Module.RemoveMessageLoop(); return nRet; }
BOOL CFPAnalysisApp::InitInstance() { // CG: The following block was added by the Splash Screen component. \ { \ CCommandLineInfo cmdInfo; \ ParseCommandLine(cmdInfo); \ \ CSplashWnd::EnableSplashScreen(cmdInfo.m_bShowSplash); \ } AfxEnableControlContainer(); //m_dlgSkin.Create(IDD_SKINDIALOG_DIALOG); //m_pSkin = m_dlgSkin.GetDlgItem(IDC_SKIN2)->GetControlUnknown(); //m_dlgAgent.Create(IDD_AGENT_DIALOG); //m_theAgent.Probe(&m_dlgAgent.m_Agent); // 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. #ifdef _AFXDLL Enable3dControls(); // Call this when using MFC in a shared DLL #else Enable3dControlsStatic(); // Call this when linking to MFC statically #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("Fingerprint Analysis 1.00")); LoadStdProfileSettings(4); // Load standard INI file options (including MRU) // Register the application's document templates. Document templates // serve as the connection between documents, frame windows and views. CMultiDocTemplate* pDocTemplate; pDocTemplate = new CMultiDocTemplate( IDR_FPANALTYPE, RUNTIME_CLASS(CFPAnalysisDoc), RUNTIME_CLASS(CChildFrame), // custom MDI child frame RUNTIME_CLASS(CFPAnalysisView)); AddDocTemplate(pDocTemplate); EnableShellOpen(); // create main MDI Frame window CMainFrame* pMainFrame = new CMainFrame; if (!pMainFrame->LoadFrame(IDR_MAINFRAME)) return FALSE; m_pMainWnd = pMainFrame; //Drag & Drop support m_pMainWnd->DragAcceptFiles(); // Parse command line for standard shell commands, DDE, file open CCommandLineInfo cmdInfo; ParseCommandLine(cmdInfo); // no new document at start-up cmdInfo.m_nShellCommand = CCommandLineInfo::FileNothing; // 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->CenterWindow(); pMainFrame->UpdateWindow(); pMainFrame->SetTitle("Fingerprint Analysis"); return TRUE; }
int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ LPTSTR lpCmdLine, _In_ int nCmdShow) { m_cefApp = new ClientApp(); if (!(m_cefApp->Init(hInstance) < 0)) return FALSE; CWndShadow::Initialize(hInstance); wstring strFileName = ZYM::CPath::GetAppPath() + _T("ImageOleCtrl.dll"); BOOL bRet = DllRegisterServer(strFileName.c_str()); // 注册COM组件 if (!bRet) { ::MessageBox(NULL, _T("COM组件注册失败,应用程序无法完成初始化操作!"), _T("提示"), MB_OK); return 0; } HRESULT hr = ::OleInitialize(NULL); if (FAILED(hr)) return 0; GdiplusStartup(&g_gdiplusToken, &g_gdiplusStartupInput, NULL); // 初始化GDI+ HMODULE hRichEditDll = ::LoadLibrary(_T("Riched20.dll")); // 加载RichEdit控件DLL CPaintManagerUI::SetInstance(hInstance); CPaintManagerUI::SetResourcePath(CPaintManagerUI::GetInstancePath() + _T("SkinRes")); HRESULT Hr = ::CoInitialize(NULL); if (FAILED(Hr)) return 0; CLoginWnd* pLoginFrame = new CLoginWnd(); CMainFrame *pWndFrame = new CMainFrame(pLoginFrame->m_manager); pLoginFrame->Create(NULL, _T(""), UI_WNDSTYLE_DIALOG, 0, 0, 0, 0, 0, NULL); pLoginFrame->CenterWindow(); pWndFrame->SetHandler(); int result = pLoginFrame->ShowModal(); if (result == 1) { pWndFrame->Create(NULL, _T(""), UI_WNDSTYLE_FRAME, WS_EX_WINDOWEDGE | WS_EX_ACCEPTFILES); pWndFrame->CenterWindow(); pWndFrame->ShowModal(); } else { //登录失败 } CPaintManagerUI::MessageLoop(); ::CoUninitialize(); if (hRichEditDll != NULL) // 卸载RichEdit控件DLL ::FreeLibrary(hRichEditDll); Gdiplus::GdiplusShutdown(g_gdiplusToken); // 反初始化GDI+ ::OleUninitialize(); m_cefApp->Exit(); m_cefApp = NULL; if (_globalSetting.m_logoutState == 1) { CDuiString path = GetCurrentPathW(); path += L"\\YunKa.exe"; ShellExecute(NULL, L"open", path.GetData(), NULL, NULL, SW_SHOWNOACTIVATE); } return 0; }