determine if application is already running

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

is there a simple way in .Net to determine if there is already an instance
running of an application ? I want to avoid that a user starts an application
twice.

Thanks,

Koert
 
Might be something in the system.diagnostics namespace that can do what you
want...
 
Imran Koradia said:
Take a look at the singleton design pattern.

That won't help at all, as the singleton would be local to the process.

That uses a heavyweight mutex for no good reason. SyncLock is a better
approach.

That implementation isn't threadsafe at all.

That one is (in the same way as the MS one) but doesn't point out the
simpler patterns available.

See http://www.pobox.com/~skeet/csharp/singleton.html for my take on
singletons.
 
Back
Top