Quote:
> I am running VB3 prof. on Windows 95 and am trying to
>find a way to get a list of all the visible application windows
>and iconic windows.
> If anyone knows of a procedure of VBX that will do that.
>or API calls from vb that would give the information(in a comma
>seperated string or something???).
Windows maintains a "Window List" that you can walk though with a
combination of API calls (No comma separated string, though):
declare GetDesktopWindow, GetWindow and IsVisible
dim WindowList[Some big number] as integer
Function FillUptheList
dim hWndThisWindow as integer
GW_CHILD = 5
GW_HWNDNEXT = 2
NumWindows = 0
hWndThisWindow = GetWindow(GetDesktopWindow(), GW_CHILD) 'gets the first
top level window
do while hWndThisWindow <> 0 'When it's zero, you're at the end of
the list
If IsVisible(hWndThisWindow) then
WindowList[NumWindows] = hWndThisWindow
NumWindow = NumWindows + 1
End If
hWndThisWindow = GetWindow(hWndThisWindow, GW_HWNDNEXT)
loop
Endfunction
If you want, you can run through twice, once to just count the windows -
then redim the array - then run through again to grab the window handles. A
couple of other hints:
Use GetWindowText to return the text of a window
Use GetWindow(hwnd, GW_OWNER) to check if a window is "owned"
Sorry I don't have the declare statements handy! They're pretty easy to
figure out from the SDK documentation though...
good luck
gordo