I'm using C#'s System.Diagnostic.Process
object.
One of its properties is Id
.
The Id
this produces is not the same as the PID
, shown in Windows Task Manager
.
Why is this?
You see, once this process is started.
It launches two other unmanaged processes, for which I can't explicitly get IDs for by object property references.
I have to search through all processes to find them by process name via System.Diagnostics.Process.GetProcesses()
.
I'm trying to find a reliable way to kill this process and all associated processes by PID
, the one that shows in Task Manager
.
Is there a better way?
I can't just kill all processes with the associated process names, because that might kill other instances of those processes that have nothing to do with my program.