int Main() { CMainWnd main; MSG msg; HACCEL hAccelTable; if (main.Create()== FALSE) return 1; hAccelTable = LoadAccelerators(_Module.m_hInstResource, MAKEINTRESOURCEW(IDC_ACCEL)); while (GetMessage(&msg, NULL, 0, 0)) { if (main.PreTranslateMessage(&msg) == FALSE) { if (!TranslateAccelerator(main.m_hWnd, hAccelTable, &msg)) { TranslateMessage(&msg); DispatchMessage(&msg); } } } return 0; }
// // Override InitInstance to create main window. // BOOL CPokerApp::InitInstance() { if (!AfxSocketInit()) { AfxMessageBox(IDS_SOCKETINITFAILED); return FALSE; } CMainWnd* pMainWnd = new CMainWnd(); m_pMainWnd = pMainWnd; BOOL rc = FALSE; if (pMainWnd) { rc = pMainWnd->Create(NULL, g_szWndClass); } else { rc = FALSE; AfxMessageBox(g_szNotEnoughMemory); } if (rc) rc = Global::Instance().initInstance(); return rc; }
int APIENTRY wWinMain(HINSTANCE hInstance, HINSTANCE , LPWSTR , int ) { CConfig* config = CConfig::get_instance(); if (!config->load()) return 0; using namespace DuiLib; CPaintManagerUI::SetInstance(hInstance); CPaintManagerUI::SetResourcePath(CPaintManagerUI::GetInstancePath() + L"\\skin"); HRESULT Hr = ::CoInitialize(nullptr); if (FAILED(Hr)) return 0; CMainWnd *wnd = new CMainWnd(L"MainWnd.xml"); wnd->Create(nullptr, L"player", UI_WNDSTYLE_DIALOG, WS_EX_WINDOWEDGE); wnd->ShowModal(); delete wnd; ::CoUninitialize(); delete config; _CrtDumpMemoryLeaks(); return 0; }
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 WinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPSTR /*lpCmdLine*/, int nCmdShow) { EnableMemLeakCheck(); CPaintManagerUI::SetInstance(hInstance); GdiplusStartupInput gdiplusStartupInput; ULONG_PTR gdiplusToken; GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL); HRESULT Hr = ::CoInitialize(NULL); if( FAILED(Hr) ) return 0; if( ::LoadLibrary(_T("d3d9.dll")) == NULL ) ::MessageBox(NULL, _T("加载 d3d9.dll 失败,一些特效可能无法显示!"), _T("信息提示"),MB_OK|MB_ICONWARNING); CMainWnd* pFrame = new CMainWnd(); if(pFrame == NULL) return 0; pFrame->Create(NULL,_T("UiLib Demos"), UI_WNDSTYLE_FRAME, 0L, 0, 0, 900, 600); pFrame->CenterWindow(); ::ShowWindow(*pFrame, SW_SHOW); CPaintManagerUI::MessageLoop(); ::CoUninitialize(); GdiplusShutdown(gdiplusToken); _CrtDumpMemoryLeaks(); return 0; }
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPSTR /*lpCmdLine*/, int nCmdShow) { HRESULT Hr = ::CoInitialize(NULL); if( FAILED(Hr) ) return 0; HRESULT hRes = ::OleInitialize(NULL); // 初始化UI管理器 CPaintManagerUI::SetInstance(hInstance); // 初始化资源 InitResource(); ::SetCurrentDirectory(CPaintManagerUI::GetInstancePath()); #ifndef _DEBUG CPaintManagerUI::LoadPlugin(_T("TroyControls.dll")); #else CPaintManagerUI::LoadPlugin(_T("TroyControls_d.dll")); #endif CMainWnd* pFrame = new CMainWnd(); if( pFrame == NULL ) return 0; pFrame->Create(NULL, _T("TroyBrowser"), UI_WNDSTYLE_FRAME, 0L, 0, 0, 990,690); pFrame->CenterWindow(); pFrame->ShowModal(); CPaintManagerUI::MessageLoop(); OleUninitialize(); ::CoUninitialize(); return 0; }
int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow) { EnableMemLeakCheck(); CWangDianNiu_DLL::InitConsoleWindow(); HRESULT Hr = ::CoInitialize(NULL); if( FAILED(Hr) ) return 0; CWkeWebkitUI::WkeWebkit_Init(); CPaintManagerUI::SetInstance(hInstance); //DuiLib::CDuiString instancePath = CPaintManagerUI::GetInstancePath(); //instancePath += "Skin\\"; //CPaintManagerUI::SetResourcePath(instancePath); CMainWnd* pFrame = new CMainWnd(); if(pFrame == NULL) return 0; pFrame->Create(NULL,_T("ÍúµêÅ£"), UI_WNDSTYLE_FRAME, 0L, 0, 0, 1120, 600); pFrame->CenterWindow(); ::ShowWindow(*pFrame, SW_SHOW); CPaintManagerUI::MessageLoop(); CWkeWebkitUI::WkeWebkit_Shutdown(); ::CoUninitialize(); CWangDianNiu_DLL::FreeConsoleWindow(); _CrtDumpMemoryLeaks(); return 0; }
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPSTR /*lpCmdLine*/, int nCmdShow) { CPaintManagerUI::SetInstance(hInstance); HRESULT Hr = ::CoInitialize(NULL); if( FAILED(Hr) ) return 0; CMainWnd* pFrame = new CMainWnd(); if( pFrame == NULL ) return 0; pFrame->Create(NULL, _T("я╦ювсно╥╨пвс"), UI_WNDSTYLE_FRAME, 0L, 0, 0, 990,690); pFrame->CenterWindow(); CPaintManagerUI::MessageLoop(); ::CoUninitialize(); return 0; }
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; }
UINT_PTR CNavDesktopModule::Main() { if (!CheckInstance()) { return 0; } if (_InitDownInterface()) { _UpdateSelf();//程序升级 _UpdateXmlConfig();//更新界面布局xml文件 } CMessageLoop theLoop; _Module.AddMessageLoop(&theLoop); { TCHAR szPath[MAX_PATH + 1] = _T(""); ::GetModuleFileName(NULL, szPath, MAX_PATH); CPath ConfigFile; ConfigFile = szPath; ConfigFile.RemoveFileSpec(); ConfigFile.Append(L"config.dat"); CXmlReader XmlReader; if (XmlReader.LoadFile(CStringA(ConfigFile))) { if (XmlReader.Open("root\\SizeMode")) XmlReader.Read("value", Config::SizeMode); if (XmlReader.Open("root\\SkinTheme")) XmlReader.Read("value", Config::SkinTheme); if (XmlReader.Open("root\\ShowFloatBar")) XmlReader.Read("value", Config::ShowFloatBar); if (XmlReader.Open("root\\wVirtualKeyCode")) XmlReader.Read("value", (int&)Config::wVirtualKeyCode); if (XmlReader.Open("root\\wModifiers")) XmlReader.Read("value", (int&)Config::wModifiers); if (XmlReader.Open("root\\CloseMode")) XmlReader.Read("value", Config::CloseMode); if (XmlReader.Open("root\\StartupMode")) XmlReader.Read("value", Config::StartupMode); if (XmlReader.Open("root\\Transparent")) XmlReader.Read("value", Config::Transparent); if (XmlReader.Open("root\\TransparentPercent")) XmlReader.Read("value", Config::TransparentPercent); } } CMainWnd MainWnd; if (MainWnd.Create(NULL) == NULL) { ATLTRACE(_T("Main dialog creation failed!\n")); return 0; } int nRet = theLoop.Run(); _Module.RemoveMessageLoop(); return nRet; }