Minimize console application

[System.Runtime.InteropServices.DllImport("user32.dll")]
        private static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
        private const int SW_MINIMIZE = 6;
        private const int SW_MAXIMIZE = 3;
        private const int SW_RESTORE = 9;


        [STAThread]
        static void Main(string[] args)
        {
            IntPtr winHandle =
            System.Diagnostics.Process.GetCurrentProcess().MainWindowHandle;
            ShowWindow( winHandle, SW_MINIMIZE);

            Console.WriteLine("I am testing the minimize console windows");
            Console.Read();
            //System.Threading.Thread.Sleep(2000);
            
//ShowWindow( winHandle, SW_RESTORE);

        }
posted @ 2012-02-17 13:28  xpwilson  阅读(233)  评论(0编辑  收藏  举报