Detecting if another instance of the application is already running

asked15 years ago
last updated15 years ago
viewed13k times
Up Vote14Down Vote

My application needs to behave slightly differently when it loads if there is already an instance running.

I understand how to use a mutex to prevent additional instances loading, but that doesn't quite solve my problem.

For example:


Any ideas? Thankfully it doesn't need to deal with multiple user accounts or anything like that.

(C#, desktop application)

Edit: To clarify, the application doesn't need to be restricted to a single instance, just perform a slightly different start-up action if there's another instance already running. Multiple instances are fine (and expected).