MPrestonf12
May 1st, 2001, 06:14 PM
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Declare Function EnumChildWindows Lib "user32.dll" (ByVal hWndParent As Long, ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long
Declare Function GetWindowTextLength Lib "user32.dll" Alias "GetWindowTextLengthA" (ByVal hwnd As Long) As Long
Declare Function GetWindowText Lib "user32.dll" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal nMaxCount As Long) As Long
Private Const WM_QUIT = &H12
Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Long) As Long
Public Sub findwin()
Dim hwnd As Long
Dim retval As Long
hwnd = FindWindowEx(0, 0, "IEFrame", vbNullString)
If hwnd <> 0 Then
retval = EnumChildWindows(hwnd, AddressOf EnumChildProc, 0)
End If
End Sub
Public Function EnumChildProc(ByVal hwnd As Long, ByVal lParam As Long) As Long
Static count As Integer
Dim length As Long, retval As Long
Dim buffer As String
count = count + 1
length = GetWindowTextLength(hwnd) + 1
buffer = Space(length)
retval = GetWindowText(hwnd, buffer, length)
Debug.Print "Window "; count; " : ";
Debug.Print Left(buffer, length - 1)
EnumChildProc = 1
End Function
Shoulden't this code enumerate all of IE's cjild windows. When I run it it says there are like 27 windows open yet all I have open is a parent window IE and a popup inside it. I don't know what the problem is. Thanks
Declare Function EnumChildWindows Lib "user32.dll" (ByVal hWndParent As Long, ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long
Declare Function GetWindowTextLength Lib "user32.dll" Alias "GetWindowTextLengthA" (ByVal hwnd As Long) As Long
Declare Function GetWindowText Lib "user32.dll" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal nMaxCount As Long) As Long
Private Const WM_QUIT = &H12
Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Long) As Long
Public Sub findwin()
Dim hwnd As Long
Dim retval As Long
hwnd = FindWindowEx(0, 0, "IEFrame", vbNullString)
If hwnd <> 0 Then
retval = EnumChildWindows(hwnd, AddressOf EnumChildProc, 0)
End If
End Sub
Public Function EnumChildProc(ByVal hwnd As Long, ByVal lParam As Long) As Long
Static count As Integer
Dim length As Long, retval As Long
Dim buffer As String
count = count + 1
length = GetWindowTextLength(hwnd) + 1
buffer = Space(length)
retval = GetWindowText(hwnd, buffer, length)
Debug.Print "Window "; count; " : ";
Debug.Print Left(buffer, length - 1)
EnumChildProc = 1
End Function
Shoulden't this code enumerate all of IE's cjild windows. When I run it it says there are like 27 windows open yet all I have open is a parent window IE and a popup inside it. I don't know what the problem is. Thanks