Click here to Skip to main content
12,359,064 members (66,116 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as

Stats

2.5K views
1 bookmarked
Posted

Video tip C#: Ensure only one instance is running

, 2 Nov 2011 CPOL
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

You may also be interested in...

Comments and Discussions

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