How can i use EnumChildWindows api to save all the child handles of a given parent handle to some long variables ?
Printable View
How can i use EnumChildWindows api to save all the child handles of a given parent handle to some long variables ?
Add to a Module.
Add to a FormCode: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
Code:Private Sub Command1_Click()
EnumChildWindows hwnd, AddressOf EnumChildProc, 0
For i = 0 To UBound(lHwnd)
Debug.Print lHwnd(i)
Next i
End Sub