|
-
Jun 3rd, 2001, 11:57 AM
#1
Thread Starter
Fanatic Member
hwnd IExplorer and Apps
I saw this code somewhere.....
Option Explicit
'in a module
Public Declare Function FindWindow Lib "user32.dll" Alias "FindWindowA" (ByVal lpClassName As Any, ByVal lpWindowName As Any) As Long
Public Declare Function EnumChildWindows Lib "user32" (ByVal hWndParent As Long, ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long
Private Declare Function GetClassName Lib "user32" Alias "GetClassNameA" (ByVal hWnd As Long, ByVal lpClassName As String, ByVal nMaxCount As Long) As Long
Private Declare Function SendMessageByStr& Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As String)
Private Const WM_SETTEXT = &HC
Private Const WM_GETTEXT = &HD
Public Function EnumChildProc(ByVal hWnd As Long, ByVal lParam As Long) As Long
Dim sSave$, sClassName$, sWindowText$
'Get window class name
sClassName = String(255, Chr(0))
GetClassName hWnd, sClassName, 255
sClassName = Left(sClassName, InStr(1, sClassName, Chr(0), vbTextCompare) - 1)
If LCase(sClassName) = "static" Then
'Get window text
sWindowText = String(255, Chr(0))
SendMessageByStr hWnd, WM_GETTEXT, 255, sWindowText
sWindowText = Left(sWindowText, InStr(1, sWindowText, Chr(0), vbTextCompare) - 1)
Debug.Print "Hwnd: " & hWnd & ", Class name: " & sClassName & ", Window Text: " & sWindowText
'Set window text
SendMessageByStr hWnd, WM_SETTEXT, 0, "Now you are cooking"
End If
'continue enumeration
EnumChildProc = 1
End Function
Private Sub Command2_Click()
windows = FindWindow("ieframe", vbNullString) 'returns 0 if not found
EnumChildWindows windows, AddressOf EnumChildProc, ByVal 0&
end sub
I modified the code so I put sometext in the IExplorer. But... It is not working.... ..... What am I doing wrong?.... how can I retrieve what the address combobox has in it? using the hwnd? HOW?????? THANK YOU!!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|