1. 程式人生 > >C# Console 運行之後最新化狀態欄

C# Console 運行之後最新化狀態欄

args clas tle ext wpa cnblogs ptr 後臺 name

static void Main(string[] args)
        {


            new ConsoleCtrl();

            Console.Read();
        }


    class ConsoleCtrl
    {
        [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); public ConsoleCtrl() { Console.Title = "個人工作平臺"; IntPtr ParenthWnd = new IntPtr(0); IntPtr et
= new IntPtr(0); ParenthWnd = FindWindow(null, "個人工作平臺"); ShowWindow(ParenthWnd, 2);//隱藏本dos窗體, 0: 後臺執行;1:正常啟動;2:最小化到任務欄;3:最大化 } }

C# Console 運行之後最新化狀態欄