diff --git a/GUI/Util.cs b/GUI/Util.cs index ed22293fb..bf340b1f9 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(); } }