C# 禁止程序重复启动
扫测资讯 2024-09-16 06:07 32 0
修改:Program.cs
[STAThread]
static void Main()
{
Mutex mutex = new Mutex(true, "NewGuid123456", out bool isCreatedNew);
if (!isCreatedNew)
{
MessageBox.Show(Application.ProductName + "is running...");
return;
}
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
参考: C# 禁止程序重复启动