In c#, Finding whether a process is running or not?

Posted by Peermohamedmydeen under C# category on | Points: 40 | Views : 8994

By using C# we can find whether a particular process is running or not.

We can use System.Diagnostics.Process class.

The scenario of finding a running process may come in Windows application development.

Let us consider In My machine, ABC.exe is running. And I have to check that whether it is running or not. Just call the below method with "ABC" as argument.

private bool IsProcessRunning(string sProcessName)
System.Diagnostics.Process[] proc = System.Diagnostics.Process.GetProcessesByName(sProcessName);
if (proc.Length > 0)
return true;
return false;

PMM :)

Comments or Responses

Login to post response