PDA

Click to See Complete Forum and Search --> : EnumChildWindows


eng70640
Feb 15th, 2001, 01:07 PM
How can i use EnumChildWindows api to save all the child handles of a given parent handle to some long variables ?

Feb 15th, 2001, 02:28 PM
Add to a Module.

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

Private Sub Command1_Click()
EnumChildWindows hwnd, AddressOf EnumChildProc, 0

For i = 0 To UBound(lHwnd)
Debug.Print lHwnd(i)
Next i
End Sub