Newsgroups: comp.windows.ms.programmer Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!csus.edu!borland.com!sidney From: sidney@borland.com (Sidney Markowitz) Subject: Re: Windows, Exec, Subprogram Message-ID: <1991Apr13.010556.25866@borland.com> Organization: Borland International References: <1997375683@1991Apr10.170742.799@bellcore.be> <1266500005@cdp> <1991Apr12.211658.28611@netcom.COM> Date: Sat, 13 Apr 1991 01:05:56 GMT ergo@netcom.COM (Isaac Rabinovitch) writes: >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? > >Here's another one: what's the practical difference between WinExec() >and LoadModule(). Please don't say "WinExec is an alternative to >LoadModule() and vice versa" -- only lazy techwriters are allowed to >do things like that! LoadModule() returns a handle to the instance of the module that it creates, lets you specify a couple of things inthe second parameter, and can only be used to run a Windows app. WinExec() returns a value that is not documented, other than being greater than 31 if successful, doesn't let you specify some things that LoadModule() does, and can be used to run both Windows and DOS apps. If you use LoadModule(), you can look at all the windows (using GetWindow(GW_HWNDNEXT)) and for each one call GetWindowWord(hWnd,GWW_HINSTANCE) to see if it is the same as the return value from LoadModule(). I'd be interested in hearing if anyone has a less kludy way of doing it. -- sidney markowitz