Get the Text out of the address ComboBox in Internet Explorer on a Win95/98 machine.
Get the Text out of the address ComboBox in Internet Explorer on a Win95/98 machine.
API Declarations
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
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Const WM_GETTEXT = &HD
Private Const WM_GETTEXTLENGTH = &HE
Rate Get the Text out of the address ComboBox in Internet Explorer on a Win95/98 machine.
(1(1 Vote))
On Error GoTo CallErrorA
lhWnd = FindWindowEx(lhWnd, 0, sClassName, vbNullString)
End Sub
Private Function GetAddressText() As String
On Error GoTo CallErrorA
Dim usText() As Byte ' That's right, a byte array
Dim iPos As Integer
lhWnd = 0
Call FindIt("IEFrame")
Call FindIt("WorkerA")
Call FindIt("ReBarWindow32")
Call FindIt("ComboBoxEx32")
Call FindIt("ComboBox")
Call FindIt("Edit")
ReDim usText(0 To SendMessage(lhWnd, WM_GETTEXTLENGTH, 0, ByVal 0&) + 1) ' +1 for Null Char
If UBound(usText) = 1 Then
GetAddressText = ""
Else
' Length in first word:
usText(0) = UBound(usText) And 255
usText(1) = UBound(usText) \ 256
Call SendMessage(lhWnd, WM_GETTEXT, UBound(usText), usText(0))
' Convert to string:
GetAddressText = StrConv(usText, vbUnicode)
' Get rid of Null Char:
iPos = InStr(GetAddressText, vbNullChar)
If iPos > 0 Then GetAddressText = Left(GetAddressText, iPos - 1)
End If
End Function
'To Use: use GetAddressText
Get the Text out of the address ComboBox in Internet Explorer on a Win95/98 machine. Comments
No comments yet — be the first to post one!
Post a Comment