From f6dfb25e3fe6fd529f9c62ee38feef2143199b75 Mon Sep 17 00:00:00 2001 From: ChsBuffer <33744752+chsbuffer@users.noreply.github.com> Date: Sat, 29 May 2021 16:41:17 +0800 Subject: [PATCH] Show Console NoActive Implement ConsoleLogger.ShowLog() --- Netch/Forms/MainForm.cs | 2 +- Netch/Models/Loggers/ConsoleLogger.cs | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Netch/Forms/MainForm.cs b/Netch/Forms/MainForm.cs index caeff3f8..23846a5a 100644 --- a/Netch/Forms/MainForm.cs +++ b/Netch/Forms/MainForm.cs @@ -386,7 +386,7 @@ namespace Netch.Forms { var windowStyles = (User32.WindowStyles)User32.GetWindowLong(Netch.ConsoleHwnd, User32.WindowLongFlags.GWL_STYLE); var visible = windowStyles.HasFlag(User32.WindowStyles.WS_VISIBLE); - User32.ShowWindow(Netch.ConsoleHwnd, visible ? ShowWindowCommand.SW_HIDE : ShowWindowCommand.SW_SHOW); + User32.ShowWindow(Netch.ConsoleHwnd, visible ? ShowWindowCommand.SW_HIDE : ShowWindowCommand.SW_SHOWNOACTIVATE); } #endregion diff --git a/Netch/Models/Loggers/ConsoleLogger.cs b/Netch/Models/Loggers/ConsoleLogger.cs index d2c55ce6..6f23a1d7 100644 --- a/Netch/Models/Loggers/ConsoleLogger.cs +++ b/Netch/Models/Loggers/ConsoleLogger.cs @@ -1,5 +1,6 @@ using Netch.Interfaces; using System; +using Vanara.PInvoke; namespace Netch.Models.Loggers { @@ -47,6 +48,7 @@ namespace Netch.Models.Loggers public void ShowLog() { + User32.ShowWindow(Netch.ConsoleHwnd, ShowWindowCommand.SW_SHOW); } } } \ No newline at end of file