首页 > Windows开发 > 详细

c# 控制台应用程序怎么隐藏黑窗口

时间:2015-10-29 18:00:43      阅读:432      评论:0      收藏:0      [点我收藏+]
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)
        {
            Console.Title = "WAHAHA";
            IntPtr intptr = FindWindow("ConsoleWindowClass""WAHAHA");
            if (intptr != IntPtr.Zero)
            {
                ShowWindow(intptr, 0);//隐藏这个窗口
            }
            string x;
            x = Console.ReadLine();
        }
    }
通过以上代码只能是让其闪的时间变得纪委短暂。有时候还是看到有框出现。
代码摘自网络

c# 控制台应用程序怎么隐藏黑窗口

原文:http://www.cnblogs.com/812931637Z/p/4921022.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!