From 9cdc330a48b56a0573b5e5e94071e9e58b23105a Mon Sep 17 00:00:00 2001 From: tildearrow Date: Mon, 13 Feb 2023 19:26:37 -0500 Subject: [PATCH] try to fix console mode on Windows issue #643 --- src/main.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main.cpp b/src/main.cpp index 54fbc7832..f9619eda2 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -342,6 +342,14 @@ void reportError(String what) { // TODO: CoInitializeEx on Windows? // TODO: add crash log int main(int argc, char** argv) { + // Windows console thing - thanks MarioKart7z! +#ifdef _WIN32 + DWORD winPID; + HWND winConsole=GetConsoleWindow(); + GetWindowThreadProcessId(winConsole,&winPID); + if (GetCurrentProcessId()==winPID) FreeConsole(); +#endif + initLog(); #ifdef _WIN32 // set DPI awareness