C#コンソールプログラムを起動して直接バックグラウンドを隠す
2722 ワード
[DllImport("User32.dll", EntryPoint = "FindWindow")]
private static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
[DllImport("user32.dll", EntryPoint = "FindWindowEx")] //
private static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string lpszClass, string lpszWindow);
[DllImport("User32.dll", EntryPoint = "SendMessage")] //
private static extern int SendMessage(IntPtr hWnd, int Msg, IntPtr wParam, string lParam);
[DllImport("User32.dll", EntryPoint = "ShowWindow")] //
private static extern bool ShowWindow(IntPtr hWnd, int type);
static void Main(string[] args)
{
Console.Title = " ";
IntPtr ParenthWnd = new IntPtr(0);
IntPtr et = new IntPtr(0);
ParenthWnd = FindWindow(null, " ");
ShowWindow(ParenthWnd, 0);// dos , 0: ;1: ;2: ;3:
Console.ReadLine();
}