Newsgroups: comp.windows.ms.programmer
Path: utzoo!utgpu!watserv1!watmath!hyper.hyper.com!bonneau
From: bonneau@hyper.hyper.com (Paul Bonneau)
Subject: Re: Windows, Exec, Subprogram
Message-ID: <1991Apr14.184311.26236@hyper.hyper.com>
Reply-To: bonneau@hyper.UUCP (Paul Bonneau,,)
Organization: HyperCube Inc.
References: <1997375683@1991Apr10.170742.799@bellcore.be> <1266500005@cdp> <1991Apr12.211658.28611@netcom.COM>
Date: Sun, 14 Apr 1991 18:43:11 GMT

In article <1991Apr12.211658.28611@netcom.COM> 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?
>
You can do this with either:

	EnumWindows()

	for (hwnd = GetWindow(hwndNull, GW_HWNDFIRST);
	    IsWindow(hwnd);
	    hwnd = GetWindow(hwnd, GW_HWNDNEXT))

Either way, the idea is to compare the string returned from
GetClassName() with the name of the class of the main window
in the new program.

cheers - Paul Bonneau.
