[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