Single of Instance Application

  • Thread starter Thread starter Harsh
  • Start date Start date
H

Harsh

Hello everybody I want to make sure that only a single
instance of my application is running.

i.e if the application is already running then on the
launch of application (exe) it should prompt the user
saying only one instance is allowed.

What is the best way to achieve this please using C#?


Harsh
 
* "Harsh said:
Hello everybody I want to make sure that only a single
instance of my application is running.

i.e if the application is already running then on the
launch of application (exe) it should prompt the user
saying only one instance is allowed.

What is the best way to achieve this please using C#?

See:

<http://www.google.com/groups?selm=eJCwBK#[email protected]>

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>

<http://www.plig.net/nnq/nquote.html>
 
* "Alvin Bruney said:
Process[] processes =
Process.GetProcessesByName(stProcName);if(processes.Length != 1)return
false; /*false no instance exist*/elsereturn true; /*true mean instance

This can cause problems if there are multiple processes of _different_
applications with the same name.
 
Back
Top