Private Declare Function GetDesktopWindow Lib "user32" () As Long
Private Declare Function EnumChildWindows Lib "user32" (ByVal hWndParent As Long, ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long
Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
'枚举窗口回调函数
Private Function EnumChildProc(ByVal hwnd As Long, ByVal lParam As Long) As Boolean
On Error Resume Next
Dim sBuffer As String * 255, sText As String
Call GetWindowText(hwnd, sBuffer, 256)
sText = StrZToStr(sBuffer)
EnumChildProc = True
End Function
Private Function StrZToStr(s As String) As String
If InStr(1, s, Chr$(0)) > 0 Then
StrZToStr = Left$(s, InStr(1, s, Chr$(0)) - 1)
Else
StrZToStr = s
End If
End Function