System.Diaganostics.Process.Id Isn't the Same Process Id Shown in Task Manger. Why?
Posted
by LonnieBest
on Stack Overflow
See other posts from Stack Overflow
or by LonnieBest
Published on 2010-02-23T08:12:13Z
Indexed on
2010/03/17
14:31 UTC
Read the original article
Hit count: 363
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.
© Stack Overflow or respective owner