extern void close_console (void);
extern void open_console(void);
extern void reopen_console(void);
-extern void activate_console (void);
+extern void activate_console(void);
+extern void deactivate_console(void);
extern void console_out (const TCHAR *);
extern void console_out_f (const TCHAR *, ...);
extern void console_flush (void);
int always_flush_log = 0;
TCHAR *conlogfile = NULL;
static FILE *conlogfilehandle;
+static HWND previousactivewindow;
#define WRITE_LOG_BUF_SIZE 4096
}
}
-void activate_console (void)
+void deactivate_console(void)
{
+ if (previousactivewindow) {
+ SetForegroundWindow(previousactivewindow);
+ previousactivewindow = NULL;
+ }
+}
+
+void activate_console(void)
+{
+ previousactivewindow = NULL;
if (!consoleopen)
return;
- SetForegroundWindow (GetConsoleWindow ());
+ previousactivewindow = GetForegroundWindow();
+ SetForegroundWindow(GetConsoleWindow());
}
static void open_console_window (void)