Winform 禁止重复启动,单实例exe程序
修改"Program.cs"文件
using System; using System.Collections.Generic; using System.Threading; using System.Windows.Forms; namespace WindowsFormsApp5 { static class Program { /// <summary> /// The main entry point for the application. /// </summary> [STAThread] static void Main() { bool result; Application.EnableVisualStyles(); Mutex m = new Mutex(true, Application.ProductName, out result); if (result) { Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1()); } } } }