Open windows 
Author Message
 Open windows

        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???).



Wed, 20 May 1998 03:00:00 GMT  
 Open windows

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



Thu, 21 May 1998 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Opening a File Open window for file selection in VBA

2. window.open / windows problem

3. Open Window in background

4. Opening Windows Explorer

5. How to open Windows Apps from Access

6. A97: Close all open windows

7. Troubleshooting Error when attempting to open windows address book

8. VBA Editor - Open Windows

9. MS Word VBA: Looping through opened Windows

10. Close all open windows

11. Customizing the File/Open window???

12. OPen window

 

 
Powered by phpBB® Forum Software