Results 1 to 5 of 5

Thread: Help, windows opened

  1. #1
    Guest
    Help,

    Could you please give me some peice of code that
    will tell me all the windows opened at a certain
    time

    Thanks in advance,

  2. #2
    PowerPoster
    Join Date
    Aug 2000
    Location
    India
    Posts
    2,288
    Have you tried "EnumWindows". It is used to enumerate all top level windows. I have never used it so I don't have the code, but I think it would be pretty easy.

  3. #3
    Guest

    Wink

    could you tell me the enumwindows code

  4. #4
    PowerPoster
    Join Date
    Aug 2000
    Location
    India
    Posts
    2,288
    Put this code in a form
    Code:
    Public Function ListWindows() As Long
        
        Dim rc As Long
        Dim lParam As Long
        
        'We're not concerned with a custom message at this time
        lParam = 0
        
        'call the api
        ListWindows = EnumWindows(AddressOf EnumWindowsProc, lParam)
        
    End Function
    
    Private Sub Command1_Click()
        Call ListWindows
    End Sub
    Put this code in a standard basic module(not in form or in class module)
    Code:
    Public Declare Function EnumWindows Lib "user32" (ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long
    
    Public Function EnumWindowsProc(ByVal hwnd As Long, ByVal lParam As Long) As Boolean
        
        Debug.Print hwnd
        
        'while this value is true it will keep on searching for open windows till it reaches
        'the last window
        EnumWindowsProc = True
        
    End Function
    But this will return you a large number of handle's. If you need only those on the desktop, try "EnumDesktopWindows" instead.

  5. #5
    Frenzied Member Jop's Avatar
    Join Date
    Mar 2000
    Location
    Amsterdam, the Netherlands
    Posts
    1,986
    Download my window class: http://www.geocities.com/despotez/WH/

    it has an example to get all the open windows too.
    Jop - validweb.nl

    Alcohol doesn't solve any problems, but then again, neither does milk.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width