using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace U_Disk_tool
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
bool runone;
System.Threading.Mutex run = new System.Threading.Mutex(true, "single_test", out runone);//设置互斥信号量
if (runone)
{
run.ReleaseMutex();
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}else{
MessageBox.Show("Exists");
}
}
}
}
C#程序只运行一个实例
最新推荐文章于 2019-07-23 01:55:15 发布