How to find parent process' PID?

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?
 
H

Herfried K. Wagner [MVP]

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top