How to find parent process' PID?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I know how to use Process.GetCurrentProcess to find out the PID of the
current application (vb.net) but I'd like to know the PARENT process PID
somehow. I've been looking at various methods including some of the WMI
stuff but inside VB.NET I'm still kind of confused about how to do it. Any
ideas?
 
coroto said:
I know how to use Process.GetCurrentProcess to find out the PID of the
current application (vb.net) but I'd like to know the PARENT process PID
somehow. I've been looking at various methods including some of the WMI
stuff but inside VB.NET I'm still kind of confused about how to do it.
Any
ideas?

The .NET Framework AFAIK doesn't provide managed functionality to determine
a process' parent process ID.

PInvoke/Win32:

Functions 'CreateToolhelp32Snapshot', 'Process32First', 'Process32Next',
structure 'PROCESSENTRY32' has a member named 'th32ParentProcessID'.

Maybe some useful hints:

<URL:http://www.google.to/groups?q=dotnet+th32ParentProcessID+-herfried>

WMI:

'Win32_Process' has a property named 'ParentProcessId'. WMI can be accessed
using the "System.Management.dll" assembly.
 
Back
Top