diff options
author | Alexander Lantsev <aunsane@gmail.com> | 2015-06-23 09:26:59 +0000 |
---|---|---|
committer | Alexander Lantsev <aunsane@gmail.com> | 2015-06-23 09:26:59 +0000 |
commit | 34c0b8e8dba1e82842f61eb4ccc2b9ab2696695a (patch) | |
tree | 8fbfdaa23adc6af73b04b2bdd5103b568a05a09a /plugins/MirLua/src/mlua_console.cpp | |
parent | 4a73d25004e811c187115dc95236553c704fe76b (diff) |
MirLua: console should not terminate miranda process
git-svn-id: http://svn.miranda-ng.org/main/trunk@14347 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/MirLua/src/mlua_console.cpp')
-rw-r--r-- | plugins/MirLua/src/mlua_console.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/plugins/MirLua/src/mlua_console.cpp b/plugins/MirLua/src/mlua_console.cpp index 75a51585b6..1a4fc5da1b 100644 --- a/plugins/MirLua/src/mlua_console.cpp +++ b/plugins/MirLua/src/mlua_console.cpp @@ -1,5 +1,10 @@ #include "stdafx.h"
+BOOL WINAPI ConsoleHandler(DWORD cEvent)
+{
+ return TRUE;
+}
+
CMLuaConsole::CMLuaConsole(lua_State *L)
: L(L), hConsole(NULL)
{
@@ -9,9 +14,15 @@ CMLuaConsole::CMLuaConsole(lua_State *L) {
if (AllocConsole())
{
+ SetConsoleTitle(_T("MirLua Console"));
freopen("CONOUT$", "w", stdout);
hConsole = CreateConsoleScreenBuffer(GENERIC_READ | GENERIC_WRITE, 0, NULL, CONSOLE_TEXTMODE_BUFFER, NULL);
- SetConsoleTitle(_T("MirLua Console"));
+ if (HWND hConsoleWindow = GetConsoleWindow())
+ {
+ HMENU hConsoleMenu = GetSystemMenu(hConsoleWindow, FALSE);
+ DeleteMenu(hConsoleMenu, SC_CLOSE, MF_BYCOMMAND);
+ }
+ SetConsoleCtrlHandler(ConsoleHandler, true);
}
}
}
|