Click here to Skip to main content
15,884,473 members
Articles / Programming Languages / C#

Video tip C#: Ensure only one instance is running

Rate me:
Please Sign up or sign in to vote.
5.00/5 (2 votes)
2 Nov 2011CPOL 5.4K   1  
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,...

Alternatives

Members may post updates or alternatives to this current article in order to show different approaches or add new features.

Please Sign up or sign in to vote.
2 Nov 2011impeham
I would use a mutex object - using the process name might cause errors. Try "WaitOne" on the mutex - only the first process will be able to acquire it, and in the case of a failure, just exit.
Please Sign up or sign in to vote.
24 Oct 2011Shivprasad koirala 3 alternatives  
How to ensure that only 1 instance of the windows application is running
Please Sign up or sign in to vote.
11 Dec 2011vijaygokarn130
[STAThread]s...

License

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


Written By
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions