manipulating child processes under Windows

Syver Enstad syver-en+usenet at
Tue Jun 4 19:31:22 CEST 2002

Douglas Alan <nessus at> writes:
> So, I have two questions:
> (1) Is this thing where a stub process fires off the real process a
>     typical thing to do under Windows?  If so, it seems to make
>     synchronizing processes difficult.

Yes, many gui processes do this, it's a way to send cmd line arguments
to a long running process, f.ex explorer which work in this way.

> (2) What's the best way for me to solve the problem.  I.e., what's the
>     best way to get my Python script to wait for the real program to
>     terminate?
> |>oug

Hmm, my first reaction is to think in terms of window handles in some
way, there's a FindWindow function in win32 (and win32all) that let's
you search for a window by name, I'll have to check the msdn library to find
out how to get the owning process handle from a window handle.


This seems to be it:

It takes a window handle (HWND) as input and returns the thread id and
the process id. Now you can use the process id to get a handle to the
process and wait on that.

Does that help? If you don't already have it get dynwin/calldll so
that you can call api functions that aren't covered by win32all, I
don't seem to find GetWindowThreadProcessId in win32all.


Vennlig hilsen 

Syver Enstad

More information about the Python-list mailing list