Results 1 to 5 of 5

Thread: Handles!

  1. #1
    Mine_23
    Guest
    Hello;
    Can someone tell me how to retrieve all the 'handles' of all the Windows.

  2. #2
    Member
    Join Date
    Nov 2000
    Location
    Manila, Philippines
    Posts
    51
    I personally haven`t tried this yet.

    But there is a web site that can help you.

    http://www.allapi.net/

    Plus, they have an API-Guide (with tons of examples, and a list of API Functions)....
    .... and an API-Toolshed, a replacement for VB`s API Viewer utility.
    (Download for FREE!)

    Here is a start: EnumWindows API Function Call

    The EnumWindows function enumerates all top-level windows on the screen by passing the handle of each window, in turn, to an application-defined callback function. EnumWindows continues until the last top-level window is enumerated or the callback function returns FALSE.

    Search for this function on the site, they have an example.
    Programmers dont byte, they just nibble a bit.

  3. #3
    Guest
    Add to a Module
    Code:
    Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
    Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hwnd As Long) As Long
    Declare Function EnumWindows Lib "user32.dll" (ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long
    
    Public Function EnumWindowsProc(ByVal hwnd As Long, ByVal lParam As Long) As Long
        Dim Length As Long
        Dim sName As String
        Dim Temp As String
        Static iCount As Integer
        
        iCount = iCount + 1
        Length = GetWindowTextLength(hwnd) + 1
        
        If Length > 1 Then
          sName = Space(Length)
          GetWindowText hwnd, sName, Length
          Debug.Print Left(sName, Length - 1)
        End If
        
        EnumWindowsProc = 1
    End Function
    now use this line to display them (in the debug window)
    Code:
    'EnumWindows AddressOf EnumWindowsProc, 0

  4. #4
    coder. Lord Orwell's Avatar
    Join Date
    Feb 2001
    Location
    Elberfeld, IN
    Posts
    7,628

    Lightbulb

    I prefer the FindWindowEx function. You can use this to enumerate all top level windows, and then plug in each of their handles to enumerate the lower level child windows and so on. Read up on it. I love this function. You can search by class or window name if you so choose, etc.
    My light show youtube page (it's made the news) www.youtube.com/@lightsofelberfeld
    Contact me on the socials www.facebook.com/lordorwell

  5. #5
    Guest
    You can find the child windows but using the EnumChildwindows function.

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