Merge pull request #998 from djtuBIG-MaliceX/bugfix/#643-win32-console-vs-gui-strategy
Issue #643 - Rewrite CLI vs GUI strategy (this matches another tracker)
This commit is contained in:
commit
6e3352e052
|
@ -780,6 +780,8 @@ endif()
|
|||
|
||||
if(ANDROID AND NOT TERMUX)
|
||||
add_library(furnace SHARED ${USED_SOURCES})
|
||||
elseif(WIN32)
|
||||
add_executable(furnace WIN32 ${USED_SOURCES})
|
||||
else()
|
||||
add_executable(furnace ${USED_SOURCES})
|
||||
endif()
|
||||
|
|
12
src/main.cpp
12
src/main.cpp
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue