Detach and reattach console on start

This commit is contained in:
Daniel S. 2019-11-20 20:50:31 +01:00
parent 934fd3881c
commit 20a4d53b22
1 changed files with 7 additions and 5 deletions

View File

@ -37,12 +37,14 @@ void SetupStreams()
void SetupConsole()
{
if (!AllocConsole())
{
FreeConsole();
AllocConsole();
if (!AttachConsole(-1)) {
if (!AllocConsole())
{
FreeConsole();
AllocConsole();
}
AttachConsole(GetCurrentProcessId());
}
AttachConsole(GetCurrentProcessId());
SetupStreams();
}