当前位置:首页 > Windows程序 > 正文

MessageBoxButtons.OK

2024-03-31 Windows程序

using System; using System.Collections.Generic; using System.Linq; using System.Windows.Forms; using System.Threading; namespace WindowsFormsApplication1 { static class Program { /// <summary> /// The main entry point for the application. /// </summary> [STAThread] static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); bool ret; Mutex mutex = new Mutex(true, Application.ProductName, out ret); if (ret) { Application.Run(new Form1()); } else { MessageBox.Show("该措施已经启动", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } }

应用措施多次启动会因为资源占用等问题对措施的正常运行孕育产生影响,,在某些情况下需要对措施的启动次数进行限制。红色部分代码的感化是制止措施反复启动。

标签:

原文地点:https://www.cnblogs.com/LicwStack/p/8587352.html

温馨提示: 本文由Jm博客推荐,转载请保留链接: https://www.jmwww.net/file/34162.html

Jm-杰米博客Jamie
草根站长的技术交流乐园!IT不会不要紧快来好好学习吧!
  • 20786文章总数
  • 7494588访问次数
  • 建站天数
  • 友情链接