MessageBoxButtons.OK

时间:2022-02-16 04:08:35

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