Results 1 to 2 of 2

Thread: EnumChildWindows

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Dec 2000
    Posts
    71

    Question

    How can i use EnumChildWindows api to save all the child handles of a given parent handle to some long variables ?

  2. #2
    Guest
    Add to a Module.
    Code:
    Declare Function EnumChildWindows Lib "user32" (ByVal hWndParent As Long, ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long
    Public lHwnd() As Long
    Public iCount As Integer
    
    Function EnumChildProc(ByVal hwnd As Long, ByVal lParam As Long) As Long
        iCount = iCount + 1
        ReDim Preserve lHwnd(iCount)
        lHwnd(iCount) = hwnd
        EnumChildProc = 1
    End Function
    Add to a Form
    Code:
    Private Sub Command1_Click()
        EnumChildWindows hwnd, AddressOf EnumChildProc, 0
        
        For i = 0 To UBound(lHwnd)
            Debug.Print lHwnd(i)
        Next i
    End Sub

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