Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hWnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Declare Function EnumChildWindows Lib "user32" (ByVal hWndParent As Long, ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long
Declare Function GetClassName Lib "user32" Alias "GetClassNameA" (ByVal hWnd As Long, ByVal lpClassName As String, ByVal nMaxCount As Long) As Long

Const WM_GETTEXT = &HD
Const WM_GETTEXTLENGTH = &HE


Public Function EnumChildProc(ByVal hWnd As Long, ByVal lParam As Long) As Long
Dim sSave$, sClassName$, sWindowText$, iLength As Long

'Get window class name
sClassName = String(255, Chr(0))
GetClassName hWnd, sClassName, 255
sClassName = Left(sClassName, InStr(1, sClassName, Chr(0), vbTextCompare) - 1)

'Get window text
sWindowText = String(255, Chr(0)) 'get length of buffer from getwindowtextlength
GetWindowText hWnd, sWindowText, 255
sWindowText = Left(sWindowText, InStr(1, sWindowText, Chr(0), vbTextCompare) - 1)

Debug.Print hwnd

'continue enumeration
EnumChildProc = 1
End Function