int Run(LPTSTR /*lpstrCmdLine*/ = NULL, int nCmdShow = SW_SHOWDEFAULT) { CMessageLoop theLoop; _Module.AddMessageLoop(&theLoop); g_hMenuGroup = LoadMenu( _Module.GetResourceInstance(), MAKEINTRESOURCE( IDR_MENU_GROUP ) ); g_hMenuGroup = GetSubMenu( g_hMenuGroup, 0 ); g_hMenuColor = LoadMenu( _Module.GetResourceInstance(), MAKEINTRESOURCE( IDR_MENU_COLOR ) ); g_hMenuColor = GetSubMenu( g_hMenuColor, 0 ); CMainWnd wndMain; char szTitle[256] = { 0 }; sprintf( szTitle, "%s %s", GetAppName(), GetAppVer() ); if( NULL == wndMain.Create( NULL, CWindow::rcDefault, szTitle, WS_VISIBLE | WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX ) ) { ATLTRACE( _T("Main window creation failed!\n") ); return( 0 ); } wndMain.ShowWindow( nCmdShow ); int nRet = theLoop.Run(); _Module.RemoveMessageLoop(); return nRet; }
int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ LPTSTR lpCmdLine, _In_ int nCmdShow) { ::CoInitialize(NULL); CPaintManagerUI::SetInstance(hInstance);// 加载XML的时候,需要使用该句柄去定位EXE的路径,才能加载XML的路径 窗口实例句柄 CMainWnd *pMainWnd = new CMainWnd; pMainWnd->Create(NULL, L"WeChatMain", UI_WNDSTYLE_FRAME, WS_EX_WINDOWEDGE); pMainWnd->CenterWindow(); pMainWnd->ShowWindow(); CPaintManagerUI::MessageLoop(); delete pMainWnd; ::CoInitialize(NULL); return 0; }
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPSTR /*lpCmdLine*/, int nCmdShow) { Poco::NamedMutex unique("SRTool"); if (!unique.tryLock()) return 0; CPaintManagerUI::SetInstance(hInstance); CPaintManagerUI::SetResourcePath(CPaintManagerUI::GetInstancePath() + _T("skin")); HRESULT Hr = ::CoInitialize(NULL); if (FAILED(Hr)) return 0; CMainWnd Frame; Frame.Create(NULL, NULL, UI_WNDSTYLE_DIALOG, WS_EX_WINDOWEDGE | WS_EX_ACCEPTFILES); Frame.SetIcon(IDI_ICON1); Frame.CenterWindow(); Frame.ShowWindow(true); CPaintManagerUI::MessageLoop(); ::CoUninitialize(); return 0; }