Added ability to hide console window

This commit is contained in:
Ivan 2023-04-22 22:35:08 +03:00 committed by GitHub
parent f178750fea
commit a76daddf31
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,5 +1,6 @@
#include "Utils.h" #include "Utils.h"
#include <stdio.h> #include <stdio.h>
#include <fstream>
HANDLE _out = NULL, _old_out = NULL; HANDLE _out = NULL, _old_out = NULL;
HANDLE _err = NULL, _old_err = NULL; HANDLE _err = NULL, _old_err = NULL;
@ -7,6 +8,9 @@ HANDLE _in = NULL, _old_in = NULL;
void Utils::AttachConsole() void Utils::AttachConsole()
{ {
std::ifstream f(".noconsole");
if (f.good()) return;
_old_out = GetStdHandle(STD_OUTPUT_HANDLE); _old_out = GetStdHandle(STD_OUTPUT_HANDLE);
_old_err = GetStdHandle(STD_ERROR_HANDLE); _old_err = GetStdHandle(STD_ERROR_HANDLE);
_old_in = GetStdHandle(STD_INPUT_HANDLE); _old_in = GetStdHandle(STD_INPUT_HANDLE);