🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.windows.ms.programmer
Article #1077

Re: FindWindow() question, not documented(!)

#1077
From: David D'SOUZA
Date: Tue, 15 Jan 1991 06:35
40 lines
2192 bytes
FindWindow will only look for a TOPLEVL window with the given class or
title name.  Child window or even MDI children aren't searched. It will
also find only the first such window it comes upon.  If there are more,
you gotta do it differently than FindWindow.

So, what are your choices?? Check out the EnumWindows function.  This
enumerates all top level windows  and calls back a function.  in this
function you can recursively call EnumChildWIndows to run through all
child windows of the given window.  You can check the window text by
making calls to GetWindowText or check the class name by GetClassName.
(Don't forget to export and makeprocinstance the call backs.)

Another choice is to walk the window list yourself via GetWindow
GW_HWNDCHILD and GW_HWNDNEXT calls.

HWNDCHILD gives you the first child of the window. HWNDNEXT gives you 
the next sibling of the window  passed in.

Start out your walk with GetWindow(GetDesktopWindow(), GW_HWNDCHILD)).
This gives you the first toplevel window in this list.. You can recursively
walk its siblings and children in a much cleaner fashion than the EnumWindows
callback..

--Dave



In article <1991Jan9.050715.1567@javelin.es.com> lwallace@javelin.es.com (Lynn Wallace) writes:
>I'll need to use the FindWinow() function to locate a window by title.  But
>the dox don't say what happens if there's more than one instance of an app
>(window) running.  Does anyone know, or should I call Microsoft?  (What's their
>number?)
>
>I will need to know the handles for all windows matching the title I look for...
>
>Thanks for any help!
>
>-- 
>Lynn Wallace			   |I speak for absolutely no one.
>Evans and Sutherland Computer Corp.|
Technical Details
Message-ID: <70035@microsoft.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!censor!geac!torsqnt!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!microsoft!davidds
References: <1991Jan9.050715.1567@javelin.es.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!censor!geac!torsqnt!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!microsoft!davidds
From: davidds@microsoft.UUCP (David D'SOUZA)
Newsgroups: comp.windows.ms.programmer
Subject: Re: FindWindow() question, not documented(!)
Message-ID: <70035@microsoft.UUCP>
Date: 15 Jan 91 06:35:23 GMT
References: <1991Jan9.050715.1567@javelin.es.com>
Reply-To: davidds@microsoft.UUCP (David D'SOUZA)
Organization: Microsoft Corp., Redmond WA
Lines: 40