Skip to content

Commit

Permalink
Use better console hiding API
Browse files Browse the repository at this point in the history
  • Loading branch information
HebaruSan committed Mar 6, 2024
1 parent 4b56375 commit be058dd
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions GUI/Util.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,14 @@ public static void AsyncInvoke<T>(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();
}
}

Expand Down

0 comments on commit be058dd

Please sign in to comment.