Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!rpi!zaphod.mps.ohio-state.edu!wuarchive!decwrl!deccrl!bloom-beacon!eru!hagbard!sunic!fuug!tuura!risto From: risto@tuura.UUCP (Risto Lankinen) Newsgroups: comp.windows.ms.programmer Subject: Re: Windows, Exec, Subprogram Message-ID: <1151@tuura.UUCP> Date: 15 Apr 91 08:14:11 GMT References: <1997375683@1991Apr10.170742.799@bellcore.be> <1266500005@cdp> <1991Apr12.211658.28611@netcom.COM> Organization: Nokia Data Systems Oy Lines: 30 ergo@netcom.COM (Isaac Rabinovitch) writes: >In <1266500005@cdp> jeff@cdp.UUCP writes: >>By the way, note that WinExec() is asynchronous, and will probably >>return before the requested program has completed. >Which reminds me of a problem that's been bothering me since I first >started playing with windows: when you WinExec() or LoadModule() a >program, how to you find out the handle of the window you've just >created? Hi! You have no knowledge, of whether you actually have had a window created via WinExec()/LoadModule() call - or whether you have had more than one window created for that matter. You have to make assumptions about the program being executed. Supposing it makes at least one 'standard' window, you should use LoadModule() to get the instance handle of the executed application in return. Then search thru all of the windows with a suitably parametrized GetWindow() loop, comparing each window's instance (with GetWindowWord(...,GWW_HINSTANCE); ) to the value you got from the LoadModule() . The one{s} that match is {are} what you want. Terveisin: Risto Lankinen -- Risto Lankinen / product specialist *************************************** Nokia Data Systems, Technology Dept * 2 2 * THIS SPACE INTENTIONALLY LEFT BLANK * 2 -1 is PRIME! Now working on 2 +1 * replies: risto@yj.data.nokia.fi ***************************************