lwallace@javelin.es.com (Lynn Wallace) (01/09/91)
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.|
gpsteffl@sunee.waterloo.edu (Glenn Patrick Steffler) (01/10/91)
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 just wrote code to do this for my tool popups last night...lucky you! FindWindow will indeed find only a single instances window. However, why not just do the following: hwndNext = GetWindow (hwndParent, GW_HWNDFIRST); while (hwndNext) { if ((GetParent(hwndNExt) == hwndParent) && (GetWindowLong(hwndNext, GWL_STYLE) & WS_POPUP) { // yahoo! land ho! GetWindowText (hwndNext, sz, sizeof(sz)-1); if (lstrcmp (sz, "title") == 0) break; } } ** by the way, I am doing this from the top of my head. But it looks right! The code about assumes the window is a popup window. Thus is is on the same level as all top level windows in the manager list. >I will need to know the handles for all windows matching the title I look for Not with this code you don't. In fact I have only 10 globals in my program of over 180k non-debug compiled. If I can, a Gerbil could. >Thanks for any help! >-- >Lynn Wallace |I speak for absolutely no one. >Evans and Sutherland Computer Corp.| -- Co-Op Scum "Bo doesn't know software" - George Brett "The galaxial hearth steams the sea as the sky blood red embrasses darkness" -John Constantine (HellBlazer) Glenn Steffler
woodman@sumax.seattleu.edu (David Woodman) (01/10/91)
lwallace@javelin.es.com (Lynn Wallace): > 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?) You can't call Microsoft about windows questions. That falls under the "Professional Developer's" support system and costs $$. Before you complain about having to pay money to get a question answered, stop and think about how much money it takes to keep 50 or so windows developers. Each of those guys can get a job elsewhere that pays $40-50K easy. woodman@sumax.seattleu.edu -- ------------------------------------------------------------------------ David Woodman woodman@sumax.seattleu.edu Seattle University #include <disclaimer.std>
davidds@microsoft.UUCP (David D'SOUZA) (01/15/91)
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.|