June 2003
Intermediate to advanced
800 pages
34h 20m
English
You want to ensure that only one instance of your application can be running at once.
In the startup code for your application, check the currently running processes to see if your application is already loaded.
Limiting your application to a single instance is simply a matter of refusing to start if your application detects that another instance is already present. You can examine currently running processes using the System.Diagnostics.Process class, as described in recipe Find Other Running Processes.
The following Console application provides a simple demonstration. Typically, if you detect more than one running instance, you will simply end the application quietly on ...
Read now
Unlock full access