how to allow only one instance of an application?

  • Thread starter Thread starter assaf
  • Start date Start date
A

assaf

hi all

i want to block my users
from running more then
one instance of my app
on their machine.

how can i block my users from running more
then one instance of my app on their machines?


assaf
 
bool isFirstInstance = true;

Mutex mutex = new Mutex(true ,"INSTANCECHECK", out isFirstInstance );

if (!isFirstInstance)
{
MessageBox.Show("Another instance is running");
//...
}
//...

(you can change "INSTANCECHECK" to what you want...)
 
Back
Top