You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
680 B
C#

2 years ago
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);
}
}
}