Add win32 console for cpp template [skip ci]

This commit is contained in:
halx99 2022-12-29 19:00:40 +08:00
parent c149cb6c79
commit 22244469d4
1 changed files with 13 additions and 1 deletions

View File

@ -33,7 +33,19 @@ int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdL
UNREFERENCED_PARAMETER(hPrevInstance); UNREFERENCED_PARAMETER(hPrevInstance);
UNREFERENCED_PARAMETER(lpCmdLine); UNREFERENCED_PARAMETER(lpCmdLine);
// create the application instance
#ifdef USE_WIN32_CONSOLE
AllocConsole();
freopen("CONIN$", "r", stdin);
freopen("CONOUT$", "w", stdout);
freopen("CONOUT$", "w", stderr);
#endif
// create the application instance // create the application instance
AppDelegate app; AppDelegate app;
return Application::getInstance()->run(); int ret = Application::getInstance()->run();
#ifdef USE_WIN32_CONSOLE
FreeConsole();
#endif
} }