OK, I get it. There is no direct access to the parent information of a process using the Process class in .NET 2.0, but using the System.Diagnostics.PerformanceCounter class, you can access the parent Process ID from the Create Process ID counter name. to solve my problem, I did something similar to:
... /// check to see if the monitored application (started in myProcess) is still running public bool isRunning() { bool running = !this.myProcess.HasExited; if(!running){ foreach (Process p in Process.GetProcesses()) { PerformanceCounter pc = new PerformanceCounter("Process", "Creating Process Id", p.ProcessName); if (this.myProcess.Id == (int)pc.RawValue) { running = true; } } } return running; } ...
In this example, I did not take into account error handling, and as a more advanced solution you could track the tree of spawned processes, keeping a list of all process identifiers of the branch, this example monitors only one direct child process.
source share