1

Possible Duplicates:
What is the correct way to create a single instance application?
What is a good pattern for using a Global Mutex in C#?

Suppose i have created an exe i want that exe must run only once ..how it is possible please give suggestion

Community
  • 1
  • 1
SunilRai86
  • 990
  • 6
  • 16
  • 26

1 Answers1

4

If I understand your problem correctly this has nothing to do with having a singleton implementation. You simply need to check if your executable is currently running.

You can do this by calling Process.GetProcesses() or Process.GetProcessesByName(NameOfExecutable) and checking the return values.

Alternatively use a Mutex as suggested above by others.

Ben Cawley
  • 1,606
  • 17
  • 29