zoukankan      html  css  js  c++  java
  • c# 控制台应用程序怎么隐藏黑窗口

    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();
            }
        }
    通过以上代码只能是让其闪的时间变得纪委短暂。有时候还是看到有框出现。
    代码摘自网络
  • 相关阅读:
    继承
    构造函数,重载
    Java Scanner学习记录
    20131204-数据库基础
    20131128-正则表达式与委托
    20131125-序列化与正则表达式
    20131127-正则表达式
    20131120-接口字符串-小鸭子练习
    20131118-静态类抽象类-外部设备
    20131117-练习面向对象
  • 原文地址:https://www.cnblogs.com/812931637Z/p/4921022.html
Copyright © 2011-2022 走看看