Issue #643 - Rewrite CLI vs GUI strategy (this matches DefleMask)

This commit is contained in:
James Alan Nguyen 2023-02-25 19:20:51 +11:00
parent 9c4016b86c
commit f9cbf17a07
2 changed files with 10 additions and 6 deletions

View file

@ -342,12 +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!
// Windows console thing - thanks dj.tuBIG/MaliceX
#ifdef _WIN32
DWORD winPID;
HWND winConsole=GetConsoleWindow();
GetWindowThreadProcessId(winConsole,&winPID);
if (GetCurrentProcessId()==winPID) FreeConsole();
if (AttachConsole(ATTACH_PARENT_PROCESS)) {
freopen("CONOUT$", "w", stdout);
freopen("CONOUT$", "w", stderr);
freopen("CONIN$", "r", stdin);
}
#endif
initLog();