int Run(LPTSTR /*lpstrCmdLine*/ = NULL, int nCmdShow = SW_SHOWDEFAULT) { int nRet = 0; FUNCTION_BLOCK_INIT(); { FUNCTION_BLOCK_TRACE(0); CMessageLoop theLoop; _Module.AddMessageLoop(&theLoop); CMainFrame wndMain; if(wndMain.CreateEx() == NULL) { ATLTRACE(_T("Main window creation failed!\n")); return 0; } wndMain.ShowWindow(nCmdShow); nRet = theLoop.Run(); _Module.RemoveMessageLoop(); } FUNCTION_BLOCK_UNINIT(); return nRet; }
int Run(LPTSTR /*lpstrCmdLine*/ = NULL, int nCmdShow = SW_SHOWDEFAULT) { CMessageLoop theLoop; _Module.AddMessageLoop(&theLoop); CMainFrame wndMain; if(wndMain.CreateEx() == NULL) { ATLTRACE(_T("Main window creation failed!\n")); return 0; } wndMain.ShowWindow(nCmdShow); int nRet = theLoop.Run(); _Module.RemoveMessageLoop(); duWindowManager *wndManager_ = wndMain.getWindowManager(); if (NULL != wndManager_) { ReleaseStyle(wndManager_); } return nRet; }
int Run(LPTSTR /*lpstrCmdLine*/, int nCmdShow = SW_SHOWDEFAULT) { NetworkInit n; if (!n.init()) { msgBox(NULL, IDS_ERROR_INIT_NETWORK, MB_OK|MB_ICONERROR); return 0; } #ifndef _DEBUG // для запуска новых копий клиента из панели задач { DWORD a = GetFileAttributes(L"gamedata"); if (a == INVALID_FILE_ATTRIBUTES || !(a&FILE_ATTRIBUTE_DIRECTORY)) { WCHAR path[MAX_PATH+1]; GetModuleFileName(NULL, path, MAX_PATH); WCHAR *p = wcsrchr(path, L'\\'); int len = p-path+1; std::wstring new_cdir(path, len); SetCurrentDirectory(new_cdir.c_str()); } } #endif CMessageLoop theLoop; _Module.AddMessageLoop(&theLoop); if(_wndMain.CreateEx() == NULL) return 0; int nRet = theLoop.Run(); _Module.RemoveMessageLoop(); return nRet; }
int Run(LPTSTR /*lpstrCmdLine*/ = NULL, int nCmdShow = #ifndef _WIN32_WCE SW_SHOWDEFAULT #else // _WIN32_WCE SW_SHOWNORMAL #endif // _WIN32_WCE ) { CMessageLoop theLoop; _Module.AddMessageLoop(&theLoop); CMainFrame wndMain; if(wndMain.CreateEx() == NULL) { ATLTRACE(_T("Main window creation failed!\n")); return 0; } wndMain.ShowWindow(nCmdShow); int nRet = theLoop.Run(); _Module.RemoveMessageLoop(); return nRet; }
int Run(LPTSTR /*lpstrCmdLine*/ = NULL, int nCmdShow = SW_SHOWDEFAULT) { CMessageLoop theLoop; _Module.AddMessageLoop(&theLoop); CMainFrame wndMain; if(wndMain.CreateEx() == NULL) { ATLTRACE(_T("Main window creation failed!\n")); return 0; } if (wndMain.m_wp.showCmd == SW_MAXIMIZE) nCmdShow = SW_MAXIMIZE; if (wndMain.m_wp.rcNormalPosition.right > 0 && wndMain.m_wp.rcNormalPosition.bottom > 0 && wndMain.m_wp.rcNormalPosition.top < wndMain.m_wp.rcNormalPosition.bottom && wndMain.m_wp.rcNormalPosition.left < wndMain.m_wp.rcNormalPosition.right) wndMain.MoveWindow( wndMain.m_wp.rcNormalPosition.left, wndMain.m_wp.rcNormalPosition.top, wndMain.m_wp.rcNormalPosition.right-wndMain.m_wp.rcNormalPosition.left, wndMain.m_wp.rcNormalPosition.bottom-wndMain.m_wp.rcNormalPosition.top, FALSE); wndMain.ShowWindow(nCmdShow); int nRet = theLoop.Run(); _Module.RemoveMessageLoop(); return nRet; }
int Run(LPTSTR /*lpstrCmdLine*/ = NULL, int nCmdShow = SW_SHOWDEFAULT) { if( !RunTimeHelper::IsVista() ) { AtlMessageBox(NULL, L"Windows Vista or greater is required to run this program."); return 0; } CDwm dwm; cIsComposited = dwm.DwmIsCompositionEnabled()!=FALSE; CMessageLoop theLoop; _Module.AddMessageLoop(&theLoop); int basex = 314;//320 int basey = 290;//285 CMainFrame frame; if( frame.CreateEx(0, CRect(0, 0, basex, basey))==NULL ) { ATLTRACE(_T("Main window creation failed!\n")); return 0; } _wndMain = frame; _wndMain.ShowWindow(nCmdShow); int nRet = theLoop.Run(); _Module.RemoveMessageLoop(); return nRet; }
int Run(LPTSTR /*lpstrCmdLine*/ = NULL, int nCmdShow = SW_SHOWDEFAULT) { CMessageLoop theLoop; _Module.AddMessageLoop(&theLoop); CMainFrame wndMain; CComArenaHook hook; //hook.open(); //hook.demo7(); hook.JobShopBuilder(); if(wndMain.CreateEx() == NULL) { ATLTRACE(_T("Main window creation failed!\n")); return 0; } wndMain.ShowWindow(nCmdShow); int nRet = theLoop.Run(); _Module.RemoveMessageLoop(); return nRet; }
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; _Module.AddMessageLoop(&theLoop); HRESULT hr = S_FALSE; BOOL fSuccess = FALSE; fSuccess = InitSystemCfg(); if (!fSuccess) { pAppInitErrMessage(IDS_APP_INIT_ERROR_OUT_OF_MEMORY); return ::GetLastError(); } fSuccess = InitUserCfg(); if (!fSuccess) { pAppInitErrMessage(IDS_APP_INIT_ERROR_OUT_OF_MEMORY); return ::GetLastError(); } // command line override the registry settings LANGID wPrefLangID = pGetPreferredLangID(lpstrCmdLine); fSuccess = pLoadResourceModule(wPrefLangID); if (!fSuccess) { return 255; } // not need to initialize each time. fSuccess = NdasCommInitialize(); if (!fSuccess) { return 254; } CMainFrame wndMain; if(wndMain.CreateEx() == NULL) { ATLTRACE(_T("Main window creation failed!\n")); return 0; } wndMain.ShowWindow(nCmdShow); int nRet = theLoop.Run(); _Module.RemoveMessageLoop(); return nRet; }
int Run(LPTSTR /*lpstrCmdLine*/ = NULL, int nCmdShow = SW_SHOWDEFAULT) { tomato::message_loop theLoop; CMainFrame wndMain; if (wndMain.CreateEx() == NULL) { ATLTRACE(_T("Main window creation failed!\n")); return 0; } wndMain.ShowWindow(nCmdShow); return theLoop.run(); }
int Run(LPTSTR /*lpstrCmdLine*/ = NULL, int nCmdShow = SW_SHOWDEFAULT) { CMyMessageLoop theLoop; _Module.AddMessageLoop(&theLoop); CMainFrame wndMain; RECT rc=CWindow::rcDefault; CRegKey key; DWORD nShow=nCmdShow; sChar winpos[128]; sU32 winsz=128; key.Open(HKEY_CURRENT_USER, lpcstrTG2RegKey, KEY_READ); key.QueryDWORDValue(_T("WindowMode"), nShow); key.QueryStringValue(_T("WindowPos"), winpos, &winsz); sscanf(winpos, "%d,%d,%d,%d", &rc.left, &rc.top, &rc.right, &rc.bottom); if (rc.left>=GetSystemMetrics(SM_CXSCREEN) || rc.top>=GetSystemMetrics(SM_CYSCREEN) || rc.right<=rc.left || rc.bottom<=rc.top) // sanity checks rc=CWindow::rcDefault; key.Close(); if(wndMain.CreateEx(0, rc) == NULL) { ATLTRACE(_T("Main window creation failed!\n")); return 0; } mbHWnd = wndMain.m_hWnd; ruleMouseInit(mbHWnd); wndMain.ShowWindow(nShow); int nRet = theLoop.Run(); _Module.RemoveMessageLoop(); ruleMouseClose(); mbHWnd = 0; return nRet; }
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) { nCmdShow; //avoid level 4 warning CMessageLoop theLoop; _Module.AddMessageLoop(&theLoop); CMainFrame wndMain; if(wndMain.CreateEx() == NULL) { ATLTRACE(_T("Main window creation failed!\n")); return 0; } // wndMain.ShowWindow(nCmdShow); int nRet = theLoop.Run(); _Module.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; }
// thread proc static DWORD WINAPI RunThread(LPVOID lpData) { CMessageLoop theLoop; _Module.AddMessageLoop(&theLoop); _RunData* pData = (_RunData*)lpData; CMainFrame wndFrame; if(wndFrame.CreateEx() == NULL) { ATLTRACE(_T("Frame window creation failed!\n")); return 0; } wndFrame.ShowWindow(pData->nCmdShow); ::SetForegroundWindow(wndFrame); // Win95 needs this delete pData; int nRet = theLoop.Run(); _Module.RemoveMessageLoop(); return nRet; }
int RunWinMain(HINSTANCE hInstance, LPTSTR lpstrCmdLine, int nCmdShow) { // DLL攻撃対策 SetDllDirectory(_T("")); #if 0 #if defined (_DEBUG) && defined(_CRTDBG_MAP_ALLOC) //メモリリーク検出用 _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE); _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDOUT); _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF | _CRTDBG_CHECK_ALWAYS_DF ); //_CrtSetBreakAlloc(874); #endif #endif #if defined (_DEBUG) && defined(_CRTDBG_MAP_ALLOC) _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF ); #endif #ifdef _DEBUG // ATLTRACEで日本語を使うために必要 _tsetlocale( LC_ALL, _T("japanese") ); #endif Misc::setHeapAllocLowFlagmentationMode(); //+++ // 設定ファイルのフルパスを取得する MtlIniFileNameInit(g_szIniFileName, MAX_PATH); // 複数起動の確認 if (CheckOneInstance(lpstrCmdLine)) return 0; g_pMainWnd = NULL; // HRESULT hRes = ::CoInitialize(NULL); HRESULT hRes = ::CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); // ATLASSERT( SUCCEEDED(hRes) ); // If you are running on NT 4.0 or higher you can use the following call instead to // make the EXE free threaded. This means that calls come in on a random RPC thread // HRESULT hRes = ::CoInitializeEx(NULL, COINIT_MULTITHREADED); hRes = ::OleInitialize(NULL); ATLASSERT( SUCCEEDED(hRes) ); ATLTRACE(_T("tWinMain\n") _T("CommandLine : %s\n"), lpstrCmdLine); /* コモンコントロールを初期化 */ INITCOMMONCONTROLSEX iccx; iccx.dwSize = sizeof (iccx); iccx.dwICC = ICC_COOL_CLASSES | ICC_BAR_CLASSES | ICC_USEREX_CLASSES; int ret = ::InitCommonControlsEx(&iccx); ATLASSERT(ret); hRes = _Module.Init(ObjectMap, hInstance, &LIBID_ATLLib); //hRes = _Module.Init(NULL, hInstance); ATLASSERT( SUCCEEDED(hRes) ); int nRet = 0; bool bRun = true; bool bAutomation = false; bool bTray = false; bool bRet = _PrivateInit(); if (!bRet) { ErrorLogPrintf(_T("_PrivateInitでエラー\n")); nRet = -1; } // Init CEF CefSettings settings; settings.multi_threaded_message_loop = true; std::wstring strCachePath = CMainOption::s_strCacheFolderPath; if (strCachePath.empty()) { strCachePath = static_cast<LPCWSTR>(Misc::GetExeDirectory() + _T("cache")); } CefString(&settings.cache_path).FromWString(strCachePath); CefString(&settings.locale).FromWString(std::wstring(L"ja")); //settings.auto_detect_proxy_settings_enabled = true; ATLVERIFY(CefInitialize(settings, nullptr)); if (nRet < 0) goto END_APP; // ActiveXコントロールをホストするための準備 //AtlAxWinInit(); // コマンドライン入力によってはCOMサーバー登録及び解除を行う nRet = RegisterCOMServer(nRet, bRun, bAutomation, bTray); if (FAILED(nRet)) { ErrorLogPrintf(_T("RegisterCOMServerでエラー\n")); nRet = -1; goto END_APP; } CDonutSimpleEventManager::RaiseEvent(EVENT_PROCESS_START); if (bRun) { _Module.StartMonitor(); hRes = _Module.RegisterClassObjects(CLSCTX_LOCAL_SERVER, REGCLS_MULTIPLEUSE | REGCLS_SUSPENDED); ATLASSERT( SUCCEEDED(hRes) ); hRes = ::CoResumeClassObjects(); ATLASSERT( SUCCEEDED(hRes) ); if (bAutomation) { CMessageLoop theLoop; nRet = theLoop.Run(); } else { //+++ 起動時の環境ファイルチェック. unDonut.iniがなく // 環境ファイルが足りてなかったら起動ページをabout:warningにする. if (lpstrCmdLine == 0 || lpstrCmdLine[0] == 0) { if (HaveEnvFiles() == false) lpstrCmdLine = _T("about:warning"); } //\\nRet = Run(lpstrCmdLine, nCmdShow, bTray); //nRet = MultiThreadManager::Run(lpstrCmdLine, nCmdShow, bTray); //int nRet = 0; { CMessageLoop theLoop; _Module.AddMessageLoop(&theLoop); CMainFrame wndMain; if (wndMain.CreateEx() == NULL) { ATLTRACE( _T("Main window creation failed!\n") ); return 0; } // load windowplacement wndMain.startupMainFrameStayle(nCmdShow, /*bTray*/false); _Module.Lock(); if (CStartUpOption::s_dwParam) CStartUpOption::StartUp(wndMain); if (lpstrCmdLine && lpstrCmdLine[0] != _T('\0')) CommandLineArg(wndMain, lpstrCmdLine); wndMain.SetAutoBackUp(); //自動更新するなら、開始. // 実際のメインループ. nRet = theLoop.Run(); _Module.RemoveMessageLoop(); } } #if 1 //+++ WTLのメイン窓クローズが正常終了時に、終了コードとして1を返す... //+++ OSに返す値なので0のほうがよいはずで、 //+++ donutの他の部分では0にしているようなので //+++ しかたないので、強制的に変換. if (nRet == 1) nRet = 0; #endif _Module.RevokeClassObjects(); ::Sleep(_Module.m_dwPause); } //_PrivateTerm(); ATLTRACE(_T("正常終了しました。\n")); END_APP: _Module.Term(); ::OleUninitialize(); ::CoUninitialize(); // Shut down CEF. DWORD dwTime = ::timeGetTime(); boost::thread terminateWatch([dwTime]() { while (dwTime + (5 * 1000) > ::timeGetTime()) { if (g_bSefShutDown) return ; ::Sleep(0); } if (g_bSefShutDown == false) ExitProcess(-5); }); CefShutdown(); g_bSefShutDown = true; CDonutSimpleEventManager::RaiseEvent(EVENT_PROCESS_END); return nRet; }