C# Monitor Programs Periodically Based on PID

Posted by ThaKidd on Stack Overflow See other posts from Stack Overflow or by ThaKidd
Published on 2010-06-17T12:07:52Z Indexed on 2010/06/17 12:13 UTC
Read the original article Hit count: 293

Filed under:
|
|
|

Thank you in advance for you ideas and input.

I would like to periodically check to see if a third party program is currently running on a user's system from my program. I am currently launching the program as follows in C#:

        String plinkConString = ""; // my connection string
        Process plink = Process.Start(utilityPath + @"\putty.exe", plinkConString);
        int plinkProcessId = plink.Id;

I launch the program and grab its pid in a Windows environment. As Putty/PLink may disconnect from its SSH server at some point and close, what is the best way to monitor how this process is doing in code?

Is there a better way to launch this program to monitor its success or failure?

© Stack Overflow or respective owner

Related posts about c#

Related posts about process