[python-win32] win32pdh problems

Tim Golden tim.golden at viacom-outdoor.co.uk
Mon Feb 6 13:04:07 CET 2006


[Frank Günther]

| I use win32pdh and EnumObjectsItems ... to get pids for 
| application name.

| Has anyone a suggestion for implementing this in a different way?

Well, assuming that all you want is a PID (or a list of them)
for a given application name, you can do it with WMI. I don't
know if it will cause the same kind of problems you saw above,
but I don't see why it should:

(uses wmi module from http://timgolden.me.uk/python/wmi.html)

<code>
import wmi

c = wmi.WMI ()
for p in c.Win32_Process (Name="notepad.exe"):
  print p.ProcessId

</code>

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