Announcement

Collapse
No announcement yet.

Internet Explorer Automation - accessing controls on a web page

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Internet Explorer Automation - accessing controls on a web page

    Can you please help me?

    I am trying to port a VB application to PB/WIN 9.01 that reads the names and values of the various controls on a web page displayed by a certain instance of the Internet Explorer. Despite studying the manual/forum messages/code generated by the PB COM Browser I did not succeed so far.

    Here is the "core element" of the VB code I am trying to translate:

    Code:
    Public Sub EnumInputElements(rtSearchUrl As String)
      Dim tUrl As String
      Dim objShellWins As SHDocVw.ShellWindows
      Dim objIE As SHDocVw.InternetExplorer
      Dim objDoc As MSHTML.HTMLDocument
      Dim objInputElement As Object
      Set objShellWins = New SHDocVw.ShellWindows
      For Each objIE In objShellWins
        tUrl = objIE.LocationURL
        If Len(tUrl) Then
          If InStr(1, objIE.LocationURL, rtSearchUrl, vbTextCompare) Then
            Set objDoc = objIE.document
            Open Environ$("USERPROFILE") & "\Desktop\InputElements.txt" For Output As #1
              For Each objInputElement In objDoc.Forms(objDoc.Forms.length - 1).elements
                If Len(objInputElement.id) Then
                  Print #1, objInputElement.id; ";"; objInputElement.Value
                End If
              Next
            Close #1
          End If
        End If
      Next
    End Sub
    Any help would be greatly appreciated!

    Regards
    Heinz Salomon

  • #2
    There is excellent tutorial available by José Roca:
    Internet Explorer Automation

    You will probably need header files from here:
    Windows API Headers

    For further info on the topic you can browse Josés forum and/or visit MSDN:
    Help on IWebBrowser2 at MSDN


    Petr
    [email protected]

    Comment

    Working...
    X