
class Program |
{ |
[DllImport("user32.dll", EntryPoint = "ShowWindow", SetLastError = true)] |
static extern bool ShowWindow(IntPtr hWnd, uint nCmdShow); |
[DllImport("user32.dll", EntryPoint = "FindWindow", SetLastError = true)] |
public static extern IntPtr FindWindow(string lpClassName, string lpWindowName); |
static void Main(string[] args) |
{ |
IntPtr intptr = FindWindow("ConsoleWindowClass", Console.Title); |
if (intptr != IntPtr.Zero) |
{ |
ShowWindow(intptr, 0);//隐藏这个窗口 |
} |
。。。。 |



