Porcess control on win32

Ben C benc1 at today.com.au
Sun Mar 10 20:46:52 EST 2002


Hi,

I am trying to achieve this scenario on a Win32 machine ... 

a. create a lot of new processes (ie. open application 'x' a number of
times with different args)

b. each time 1 of the processes exits ... do something

I have looked at using somehting like this

...

project_lst = ['application1', 'application2', 'application3', etc]

for application in project_lst:

    process, thread, pid, tid = win32process.CreateProcess(
    None,
    application ,
    None,
    None,
    0,
    win32process.NORMAL_PRIORITY_CLASS,
    None,
    None,
    win32process.STARTUPINFO())
    
    win32event.WaitForSingleObject(process, win32event.INFINITE)

    print 'Application %s Has Just Exited) % (application,)
...

The problem with this structure is it spawns each application in
sequence ... how can I modify this sructure to spawn all applications
simultaneously and still have the print statement executed only when
one of the projects exits?

thanks in advance

Ben



More information about the Python-list mailing list