From da71752b021620f410dce1579632a77a9a970955 Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Tue, 21 Jun 2016 16:20:15 +0300 Subject: [PATCH] Remove notification icon if log console window is force closed. --- od-win32/writelog.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/od-win32/writelog.cpp b/od-win32/writelog.cpp index f57bf1e5..b34952d4 100644 --- a/od-win32/writelog.cpp +++ b/od-win32/writelog.cpp @@ -90,6 +90,14 @@ static void set_console_input_mode(int line) console_input_linemode = line; } +static BOOL WINAPI ctrlchandler(DWORD ct) +{ + if (ct == CTRL_C_EVENT || ct == CTRL_CLOSE_EVENT) { + systray(hHiddenWnd, TRUE); + } + return FALSE; +} + static void getconsole (void) { CONSOLE_SCREEN_BUFFER_INFO csbi; @@ -106,6 +114,7 @@ static void getconsole (void) SetConsoleScreenBufferSize (stdoutput, csbi.dwMaximumWindowSize); } } + SetConsoleCtrlHandler(ctrlchandler, TRUE); } static void flushmsgpump(void) -- 2.47.3