Make field for HWND in ConsoleListener

This commit is contained in:
gmvbif 2015-12-26 09:43:49 +03:00
parent ae1c1a0295
commit dff476c4f4
2 changed files with 4 additions and 9 deletions

View File

@ -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

View File

@ -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);