win32 process name

phil phillip.watts at anvilcom.com
Tue Dec 21 22:20:12 EST 2004


I need to know if a process is running.
not just python.exe
but python.exe myapp

from win32all
EnumProcesses gives me the pids, then
OpenProcess(pid) gives me a handle.
Then what?
GetModuleFileNameEX?  It requires two handles as args
and I can't figure out which one is the handle from OpenProcess
and what it wants for the other one and I can't find any
Win32 SDK docs that help.
Or if I could figure out this function, would it even give me
the answer.

I discovered wmi.
Win32_Process returns a list of processes.
then process.Name just gives me python.exe.
But I could have python.exe running several times.
I need to know is python.exe myapp running.
In other words, the command line.

This ought to be a nobrainer. But Nooo. Its Windows.

Any help or ideas appreciated.  Thanks.




More information about the Python-list mailing list