From 631e22caadf37a547bafccc0f90251621b0bd987 Mon Sep 17 00:00:00 2001 From: Alexander Lantsev Date: Mon, 22 Jun 2015 14:21:07 +0000 Subject: MirLua: console refactoring git-svn-id: http://svn.miranda-ng.org/main/trunk@14328 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/MirLua/src/mlua_console.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 plugins/MirLua/src/mlua_console.cpp (limited to 'plugins/MirLua/src/mlua_console.cpp') diff --git a/plugins/MirLua/src/mlua_console.cpp b/plugins/MirLua/src/mlua_console.cpp new file mode 100644 index 0000000000..75a51585b6 --- /dev/null +++ b/plugins/MirLua/src/mlua_console.cpp @@ -0,0 +1,25 @@ +#include "stdafx.h" + +CMLuaConsole::CMLuaConsole(lua_State *L) + : L(L), hConsole(NULL) +{ + if (db_get_b(NULL, MODULE, "ShowConsole", 0)) + { + if (!AttachConsole(ATTACH_PARENT_PROCESS)) + { + if (AllocConsole()) + { + freopen("CONOUT$", "w", stdout); + hConsole = CreateConsoleScreenBuffer(GENERIC_READ | GENERIC_WRITE, 0, NULL, CONSOLE_TEXTMODE_BUFFER, NULL); + SetConsoleTitle(_T("MirLua Console")); + } + } + } +} + +CMLuaConsole::~CMLuaConsole() +{ + if (hConsole) + CloseHandle(hConsole); + FreeConsole(); +} \ No newline at end of file -- cgit v1.2.3