mirror of
https://github.com/libretro/ppsspp.git
synced 2024-11-28 19:00:23 +00:00
Disable log console close button and ctrl+C effect
Avoid closing the application when the log console is closed.
This commit is contained in:
parent
f47c6d534d
commit
9ea27dd7ba
@ -72,6 +72,29 @@ ConsoleListener::~ConsoleListener()
|
|||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Handle console event
|
||||||
|
bool WINAPI ConsoleHandler(DWORD msgType)
|
||||||
|
{
|
||||||
|
if (msgType == CTRL_C_EVENT)
|
||||||
|
{
|
||||||
|
OutputDebugString(L"Ctrl-C!\n");
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
else if (msgType == CTRL_CLOSE_EVENT)
|
||||||
|
{
|
||||||
|
OutputDebugString(L"Close console window!\n");
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
Other messages:
|
||||||
|
CTRL_BREAK_EVENT Ctrl-Break pressed
|
||||||
|
CTRL_LOGOFF_EVENT User log off
|
||||||
|
CTRL_SHUTDOWN_EVENT System shutdown
|
||||||
|
*/
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// 100, 100, "Dolphin Log Console"
|
// 100, 100, "Dolphin Log Console"
|
||||||
// Open console window - width and height is the size of console window
|
// Open console window - width and height is the size of console window
|
||||||
// Name is the window title
|
// Name is the window title
|
||||||
@ -85,10 +108,15 @@ void ConsoleListener::Open(bool Hidden, int Width, int Height, const char *Title
|
|||||||
AllocConsole();
|
AllocConsole();
|
||||||
HWND hConWnd = GetConsoleWindow();
|
HWND hConWnd = GetConsoleWindow();
|
||||||
ShowWindow(hConWnd, SW_SHOWDEFAULT);
|
ShowWindow(hConWnd, SW_SHOWDEFAULT);
|
||||||
|
// disable console close button
|
||||||
|
HMENU hMenu=GetSystemMenu(hConWnd,false);
|
||||||
|
EnableMenuItem(hMenu,SC_CLOSE,MF_GRAYED|MF_BYCOMMAND);
|
||||||
// Hide
|
// Hide
|
||||||
if (Hidden) ShowWindow(hConWnd, SW_HIDE);
|
if (Hidden) ShowWindow(hConWnd, SW_HIDE);
|
||||||
// Save the window handle that AllocConsole() created
|
// Save the window handle that AllocConsole() created
|
||||||
hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
|
hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||||
|
// Set console handler
|
||||||
|
if(SetConsoleCtrlHandler((PHANDLER_ROUTINE)ConsoleHandler, TRUE)){OutputDebugString(L"Console handler is installed!\n");}
|
||||||
// Set the console window title
|
// Set the console window title
|
||||||
SetConsoleTitle(ConvertUTF8ToWString(Title).c_str());
|
SetConsoleTitle(ConvertUTF8ToWString(Title).c_str());
|
||||||
SetConsoleCP(CP_UTF8);
|
SetConsoleCP(CP_UTF8);
|
||||||
|
Loading…
Reference in New Issue
Block a user