From dff476c4f4e218218101fb543d6ed88b2242fdf7 Mon Sep 17 00:00:00 2001 From: gmvbif Date: Sat, 26 Dec 2015 09:43:49 +0300 Subject: [PATCH] Make field for HWND in ConsoleListener --- Common/ConsoleListener.cpp | 11 +++-------- Common/ConsoleListener.h | 2 +- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/Common/ConsoleListener.cpp b/Common/ConsoleListener.cpp index ddd6fd9bfb..43bbe05331 100644 --- a/Common/ConsoleListener.cpp +++ b/Common/ConsoleListener.cpp @@ -121,10 +121,10 @@ void ConsoleListener::Open() { // Open the console window and create the window handle for GetStdHandle() AllocConsole(); - HWND hConWnd = GetConsoleWindow(); - ShowWindow(hConWnd, SW_SHOWDEFAULT); + hWnd = GetConsoleWindow(); + ShowWindow(hWnd, SW_SHOWDEFAULT); // disable console close button - HMENU hMenu=GetSystemMenu(hConWnd,false); + HMENU hMenu=GetSystemMenu(hWnd, false); EnableMenuItem(hMenu,SC_CLOSE,MF_GRAYED|MF_BYCOMMAND); // Save the window handle that AllocConsole() created hConsole = GetStdHandle(STD_OUTPUT_HANDLE); @@ -513,9 +513,6 @@ void ConsoleListener::PixelSpace(int Left, int Top, int Width, int Height, bool bool DAft = true; std::string SLog = ""; - const HWND hWnd = GetConsoleWindow(); - //const HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE); - // Get console info CONSOLE_SCREEN_BUFFER_INFO ConInfo; GetConsoleScreenBufferInfo(hConsole, &ConInfo); @@ -632,8 +629,6 @@ void ConsoleListener::ClearScreen(bool Cursor) CONSOLE_SCREEN_BUFFER_INFO csbi; DWORD dwConSize; - //HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE); - GetConsoleScreenBufferInfo(hConsole, &csbi); dwConSize = csbi.dwSize.X * csbi.dwSize.Y; // Write space to the entire console diff --git a/Common/ConsoleListener.h b/Common/ConsoleListener.h index 29b57abf7a..d58eef2928 100644 --- a/Common/ConsoleListener.h +++ b/Common/ConsoleListener.h @@ -46,7 +46,7 @@ public: bool Hidden() const { return bHidden; } private: #if defined(_WIN32) && !defined(_XBOX) - HWND GetHwnd(void); + HWND hWnd; HANDLE hConsole; static unsigned int WINAPI RunThread(void *lpParam);