Results 1 to 3 of 3

Thread: Extracting links within a webbrowser control

  1. #1

    Thread Starter
    Frenzied Member Skitchen8's Avatar
    Join Date
    Feb 2001
    Location
    Binghamotn, NY
    Posts
    1,943

    Extracting links within a webbrowser control

    I have a webbrowser control that navigates to a page on an online game (http://www.outwar.com/rankings.php?t...=400&submit=go) and i want to be able to extract all the player names and links on that. I think i could probably use the inet control to get the source code and parse it, but that would take me damn well near the rest of my life to do, so im wondering if i can get the links and names off using the webbrowser control and add them to a listbox.
    Government is another way to say better…than…you.
    It’s like ice but no pick, a murder charge that won’t stick,
    it’s like a whole other world where you can smell the food,
    but you can’t touch the silverware.
    Huh, what luck. Fascism you can vote for.
    Humph, isn’t that sweet?
    And we’re all gonna die some day, because that’s the American way
    -Stone Sour

  2. #2
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,177
    Something like this will likely work:
    VB Code:
    1. Option Explicit
    2.  
    3. Private Sub Command1_Click()
    4. 'http://www.outwar.com/rankings.php?...0&submit=go
    5.   WebBrowser1.Navigate2 "http://www.outwar.com/rankings.php?...0&submit=go"
    6. End Sub
    7.  
    8. Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
    9.   If pDisp Is WebBrowser1.object Then
    10.     ' Extract Names:
    11.     ExtractNames
    12.   End If
    13. End Sub
    14.  
    15. Private Sub ExtractNames()
    16.   Dim oLink As Object
    17.  
    18.   For Each oLink In WebBrowser1.Document.All.Tags("A")
    19.     Debug.Print """" & oLink.OuterText & """", oLink.hRef
    20.   Next
    21. End Sub

  3. #3
    New Member
    Join Date
    Oct 2013
    Posts
    8

    Re: Extracting links within a webbrowser control

    Hi Aaron,

    Hopefully you are still with VBForums. I have modified version of the above question ("Extracting links within a webbrowser control").

    What if user highlighted just a PART of the text in the WebBrowser control. This highlighted text may contain one or several links. Please advise me how I can list these links from the highlighted area of WebBrowser control in VB6.

    THANKS!

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