Improve startConsole()

* Also try to allocate new console
* Don't set buffer info (seems to have not
  effect anyways)
This commit is contained in:
Martchus 2017-03-22 02:09:27 +01:00
parent 9a395a45d3
commit 5dac8fc76b
1 changed files with 3 additions and 6 deletions

View File

@ -43,12 +43,9 @@ bool confirmPrompt(const char *message, Response defaultResponse)
*/
void startConsole()
{
AttachConsole(ATTACH_PARENT_PROCESS);
CONSOLE_SCREEN_BUFFER_INFO coninfo;
GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &coninfo);
coninfo.dwSize.X = 200;
coninfo.dwSize.Y = 500;
SetConsoleScreenBufferSize(GetStdHandle(STD_OUTPUT_HANDLE), coninfo.dwSize);
if(!AttachConsole(ATTACH_PARENT_PROCESS) && !AllocConsole()) {
return;
}
// redirect stdout
auto stdHandle = reinterpret_cast<intptr_t>(GetStdHandle(STD_OUTPUT_HANDLE));
auto conHandle = _open_osfhandle(stdHandle, _O_TEXT);