提示:扫一扫查出行【扫一扫了解最新限行尾号】复制提示 使用互斥体Mutex类型
using System.Threading;
//声明互斥体
Mutex mutex = new Mutex(false, "ThisShouldOnlyRunOnce");
//判断互斥体是否使用中
bool Running = !mutex.WaitOne(, false);
if (!Running)
Application.Run(new Form1());
else
MessageBox.Show("应用程序已经启动!");