Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

detect already running 1

Status
Not open for further replies.

murrayja

Programmer
May 6, 2000
90
US
I am converting an app from VB6 to C#.
Is there an equivalent "App.Previnstance" in C# to detect if the app is already running?

 
public bool IsProcessRunning(string ProcName)
{
bool IsRunning = false;
Process[] processes;

processes = System.Diagnostics.Process.GetProcesses();

foreach (System.Diagnostics.Process instance in processes)
{
if (instance.ProcessName.ToUpper()==ProcName.ToUpper())
{
IsRunning = true;
break;
}
}
return IsRunning;
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top