C#中 让程序只能启动一次
System.Threading.Mutex mutex = new System.Threading.Mutex(false, "ThisShouldOnlyRunOnce"); bool Running = !mutex.WaitOne(0, false); if (! Running) Application.Run(new frm()); else MessageBox.Show("程序已启动!");
C#中 让程序只能启动一次
System.Threading.Mutex mutex = new System.Threading.Mutex(false, "ThisShouldOnlyRunOnce"); bool Running = !mutex.WaitOne(0, false); if (! Running) Application.Run(new frm()); else MessageBox.Show("程序已启动!");