using System; using System.Collections.Generic; using System.Linq; using System.Runtime.InteropServices; using System.Text; using System.Threading.Tasks; namespace BirdyFlash { public class ShowHideConsole { [DllImport("kernel32.dll")] static extern IntPtr GetConsoleWindow(); [DllImport("user32.dll")] static extern bool ShowWindow(IntPtr hWnd, int nCmdShow); const int SW_HIDE = 0; const int SW_SHOW = 5; public static void ToggleConsoleWindow(bool visible) { IntPtr handle = GetConsoleWindow(); ShowWindow(handle, visible ? SW_SHOW : SW_HIDE); } } }