[python-win32] How to get PID from a Proces Handle ?

Tim Golden tim.golden at viacom-outdoor.co.uk
Thu Oct 12 14:40:50 CEST 2006


[Mark Hammond]
| Sent: 12 October 2006 12:19
| To: 'Scott Hogsten'; python-win32 at python.org
| Subject: Re: [python-win32] How to get PID from a Proces Handle ?
| 
| > I have some code that spawns processes using the "spawnv"
| > command this returns a process handle.
| > Can I use the process handle to retrieve the actual PID of
| > the process ? This is part of a test harness
| > and I need to be able have the actual PID to use against 
| some output.
| 
| Good question!  It's not immediately obvious how to do this 
| simply, but at a
| pinch, maybe win32pdh or WMI could be used?

Not WMI, I'm afraid; at least, not on casual inspection.
The Handle property of the Win32_Process appears to be
an exact duplicate of the ProcessID property!

TJG

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________


More information about the Python-win32 mailing list