Does anyone know how to enumerate all of the Child windows given a parent Hwnd?
I have seached the forum for child, enumchildwindows, enum, child windows, child window. No luck. I've searched google... I've been all over the net for over 3 weeks, and I can't get anything to work.
Does anyone know how to do this? Can someone explain it to me?
I have this function that works for parent windows, I've modified it slightly to give me the hwnd as well.
Does anyone have anything that will give me the child windows for a parent?
I have seached the forum for child, enumchildwindows, enum, child windows, child window. No luck. I've searched google... I've been all over the net for over 3 weeks, and I can't get anything to work.
Does anyone know how to do this? Can someone explain it to me?
I have this function that works for parent windows, I've modified it slightly to give me the hwnd as well.
Code:
Function fEnumWindows()
Dim lngx As Long, lngLen As Long
Dim lngStyle As Long, strCaption As String
lngx = apiGetDesktopWindow()
'Return the first child to Desktop
lngx = apiGetWindow(lngx, mcGWCHILD)
Do While Not lngx = 0
strCaption = fGetCaption(lngx)
If Len(strCaption) > 0 Then
lngStyle = apiGetWindowLong(lngx, mcGWLSTYLE)
'enum visible windows only
If lngStyle And mcWSVISIBLE Then
Debug.Print "Class = " & fGetClassName(lngx),
Debug.Print "Caption = " & fGetCaption(lngx),
Debug.Print "Handle = " & lngx
End If
End If
lngx = apiGetWindow(lngx, mcGWHWNDNEXT)
Loop
End Function
Private Function fGetClassName(hwnd As Long) As String
Dim strBuffer As String
Dim intCount As Integer
strBuffer = String$(mconMAXLEN - 1, 0)
intCount = apiGetClassName(hwnd, strBuffer, mconMAXLEN)
If intCount > 0 Then
fGetClassName = Left$(strBuffer, intCount)
End If
End Function
Does anyone have anything that will give me the child windows for a parent?