Results 1 to 2 of 2

Thread: Retrieving IE5 Addressess

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Mar 2000
    Location
    Ocotlan, Jalisco, Mexico
    Posts
    18

    Talking

    Anyone know to retrieve an URL from IE5 and viceversa (send an url from VB to IE5?

    Is it possible with DDE?

    thanx for your help

  2. #2
    Guest
    Code:
    Option Explicit
    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
    
    Private Sub FindIt(ByVal sClassName As String)
    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
    I just found this code..not sure if it works. I can't check because my hard drive crashed and I have to re-install everything. But if it does work, hope that's what you were looking for.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width