From be058dd5b6e582f00db28403e95f4854506e6e86 Mon Sep 17 00:00:00 2001 From: Paul Hebble Date: Wed, 6 Mar 2024 13:28:34 -0600 Subject: [PATCH] Use better console hiding API --- GUI/Util.cs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/GUI/Util.cs b/GUI/Util.cs index ed22293fb5..bf340b1f9a 100644 --- a/GUI/Util.cs +++ b/GUI/Util.cs @@ -55,17 +55,14 @@ public static void AsyncInvoke(T obj, Action action) where T : Control // hides the console window on windows // useful when running the GUI - [DllImport("kernel32.dll")] - private static extern IntPtr GetConsoleWindow(); - - [DllImport("user32.dll")] - private static extern bool ShowWindow(IntPtr hWnd, int nCmdShow); + [DllImport("kernel32.dll", SetLastError=true)] + private static extern int FreeConsole(); public static void HideConsoleWindow() { if (Platform.IsWindows) { - ShowWindow(GetConsoleWindow(), 0); + FreeConsole(); } }