by Thomas Young (1 Submission)
Category: String Manipulation
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Sun 31st October 1999
Date Added: Mon 8th February 2021
Rating: (1 Votes)
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
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
No comments have been posted about Get the Text out of the address ComboBox in Internet Explorer on a Win95/98 machine.. Why not be the first to post a comment about Get the Text out of the address ComboBox in Internet Explorer on a Win95/98 machine..