Click here to Skip to main content
Click here to Skip to main content
Alternative Tip
Go to top

Video tip C#: Ensure only one instance is running

, 2 Nov 2011
Rate this:
Please Sign up or sign in to vote.
I really like this method, very easy to implement and understand. One minor "gotcha" about doing it this way is that it is still possible to run multiple instances under different user accounts simultaneously if the users are not administrators on the PC. If this is a scenario you need to avoid,...

I really like this method, very easy to implement and understand. One minor "gotcha" about doing it this way is that it is still possible to run multiple instances under different user accounts simultaneously if the users are not administrators on the PC. If this is a scenario you need to avoid, you can use a mutex. So, on startup, the application would:

  1. Check to see if the mutex exists already.
  2. If (1) close, else open and create the mutex.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

J. Andy Wilson

United States United States
No Biography provided

Comments and Discussions

 
-- There are no messages in this forum --
| Advertise | Privacy | Mobile
Web03 | 2.8.140916.1 | Last Updated 2 Nov 2011
Article Copyright 2011 by J. Andy Wilson
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid