How to hide a console application in C#

前端 未结 9 1876
刺人心
刺人心 2020-12-06 09:27

I have a console application in C#, and I want that the user won\'t be able to see it.

How can I do that?

9条回答
  •  一个人的身影
    2020-12-06 10:21

    To hide a console applicatin in C# when nothing else works use this code:

    [DllImport("kernel32.dll")]
    public static extern bool FreeConsole();
    

    Place FreeConsole() anywhere in the code, I placed it in the Init(), and the commandline is hidden.

提交回复
热议问题