1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
[STAThread] static void Main() { System.Threading.Mutex mutex = new System.Threading.Mutex(false, "Pulse"); if (mutex.WaitOne(0, false) == false) { MessageBox.Show("Already executing"); return; } Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1()); mutex.ReleaseMutex(); } |
参考サイト
二重起動を禁止する: .NET Tips: C#, VB.NET
http://dobon.net/vb/dotnet/process/checkprevinstance.html