Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //reference http://odetocode.com/blogs/scott/archive/2004/08/20/the-misunderstood-mutex.aspx
- [STAThread]
- static void Main()
- {
- using(Mutex mutex = new Mutex(false, @"Global\" + appGuid))
- {
- if(!mutex.WaitOne(0, false))
- {
- MessageBox.Show("Instance already running");
- return;
- }
- GC.Collect();
- Application.Run(new Form1());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment