win32 process name

Fredrik Lundh fredrik at pythonware.com
Wed Dec 22 02:21:11 EST 2004


"phil" <phillip.watts at anvilcom.com> wrote:

> 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.

http://msdn.microsoft.com/library/en-us/perfmon/base/getmodulefilenameex.asp

describes a function with two [in] arguments, and one [out] argument.
the first argument is the process handle, the second a module handle;
the second argument can be NULL.

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

it can be pretty tricky on other platforms too; that's why Unix programs usually
solve this by writing their PID to a file in a known location, so that other programs
can find them without having to resort to more or less stupid tricks.

</F> 






More information about the Python-list mailing list