<tfoot id='JIh1c'></tfoot>
      1. <i id='JIh1c'><tr id='JIh1c'><dt id='JIh1c'><q id='JIh1c'><span id='JIh1c'><b id='JIh1c'><form id='JIh1c'><ins id='JIh1c'></ins><ul id='JIh1c'></ul><sub id='JIh1c'></sub></form><legend id='JIh1c'></legend><bdo id='JIh1c'><pre id='JIh1c'><center id='JIh1c'></center></pre></bdo></b><th id='JIh1c'></th></span></q></dt></tr></i><div id='JIh1c'><tfoot id='JIh1c'></tfoot><dl id='JIh1c'><fieldset id='JIh1c'></fieldset></dl></div>
          <bdo id='JIh1c'></bdo><ul id='JIh1c'></ul>
      2. <small id='JIh1c'></small><noframes id='JIh1c'>

        <legend id='JIh1c'><style id='JIh1c'><dir id='JIh1c'><q id='JIh1c'></q></dir></style></legend>

        如何在 Visual Studio 控制台应用程序中禁用控制台

        时间:2023-08-27
            • <bdo id='DEDz2'></bdo><ul id='DEDz2'></ul>

              <small id='DEDz2'></small><noframes id='DEDz2'>

              <i id='DEDz2'><tr id='DEDz2'><dt id='DEDz2'><q id='DEDz2'><span id='DEDz2'><b id='DEDz2'><form id='DEDz2'><ins id='DEDz2'></ins><ul id='DEDz2'></ul><sub id='DEDz2'></sub></form><legend id='DEDz2'></legend><bdo id='DEDz2'><pre id='DEDz2'><center id='DEDz2'></center></pre></bdo></b><th id='DEDz2'></th></span></q></dt></tr></i><div id='DEDz2'><tfoot id='DEDz2'></tfoot><dl id='DEDz2'><fieldset id='DEDz2'></fieldset></dl></div>
              <tfoot id='DEDz2'></tfoot>

                  <legend id='DEDz2'><style id='DEDz2'><dir id='DEDz2'><q id='DEDz2'></q></dir></style></legend>
                    <tbody id='DEDz2'></tbody>
                  本文介绍了如何在 Visual Studio 控制台应用程序中禁用控制台窗口的关闭按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我需要禁用 Visual Studio 控制台的控制台窗口中的关闭按钮用 C# 编写的应用程序.我希望应用程序应该运行直到它完成并且用户不应该能够通过关闭控制台窗口来停止它.我正在使用 Visual Studio 2010

                  I need to disable the close button in the console window of a visual studio console application written in C#. I want that the application should run until it completes and the user should not be able to stop it by closing the console window. I am using visual studio 2010

                  推荐答案

                  下面是一个禁用控制台窗口关闭按钮的示例:

                  Here is an example to disable close button on console window:

                  class Program
                  {
                      private const int MF_BYCOMMAND = 0x00000000;
                      public const int SC_CLOSE = 0xF060;
                  
                      [DllImport("user32.dll")]
                      public static extern int DeleteMenu(IntPtr hMenu, int nPosition, int wFlags);
                  
                      [DllImport("user32.dll")]
                      private static extern IntPtr GetSystemMenu(IntPtr hWnd, bool bRevert);
                  
                      [DllImport("kernel32.dll", ExactSpelling = true)]
                      private static extern IntPtr GetConsoleWindow();
                  
                      static void Main(string[] args)
                      {
                          DeleteMenu(GetSystemMenu(GetConsoleWindow(), false),SC_CLOSE, MF_BYCOMMAND);
                          Console.Read();
                      }
                  }
                  

                  这篇关于如何在 Visual Studio 控制台应用程序中禁用控制台窗口的关闭按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:有没有办法删除刚刚使用 Console.WriteLine 写入的字 下一篇:为什么一个基本的单线程 C# 控制台应用程序需要

                  相关文章

                  最新文章

                  1. <tfoot id='AWCB2'></tfoot>

                  2. <small id='AWCB2'></small><noframes id='AWCB2'>

                    <i id='AWCB2'><tr id='AWCB2'><dt id='AWCB2'><q id='AWCB2'><span id='AWCB2'><b id='AWCB2'><form id='AWCB2'><ins id='AWCB2'></ins><ul id='AWCB2'></ul><sub id='AWCB2'></sub></form><legend id='AWCB2'></legend><bdo id='AWCB2'><pre id='AWCB2'><center id='AWCB2'></center></pre></bdo></b><th id='AWCB2'></th></span></q></dt></tr></i><div id='AWCB2'><tfoot id='AWCB2'></tfoot><dl id='AWCB2'><fieldset id='AWCB2'></fieldset></dl></div>
                    <legend id='AWCB2'><style id='AWCB2'><dir id='AWCB2'><q id='AWCB2'></q></dir></style></legend>

                        <bdo id='AWCB2'></bdo><ul id='AWCB2'></ul>