Results 1 to 7 of 7

Thread: Making a webbrowser without using the webrowser componet

  1. #1
    Guest

    Post

    I want to make a webrowser that at start is just a text browser but then I search through and find the tags which i then translate. How would i go about doing this?

  2. #2
    Guest

    Post

    Here is an exmple i wrote some time ago:
    Code:
    Option Explicit
    
    Private Sub Form_Load()
        MsgBox HTMLParser("<p><ul><b>This is the text you would see in the web browser.<br>Test.</b></p><br>This is the end")
    End Sub
    
    Private Function HTMLParser(ByVal sHTML As String) As String
        Dim lCounter As Long
        Dim sTemp As String
        For lCounter = 1 To Len(sHTML)
            Select Case Mid(sHTML, lCounter, 1)
                Case "<"
                    'Found a tag, should probably do something with it
                    Select Case LCase$(Mid$(sHTML, lCounter, 4))
                        Case "<br>", "</p>" 'These tag's as handled
                            '<br>, is next line; </p> is end paragraf
                            sTemp = sTemp & vbCrLf
                            lCounter = lCounter + 3
                        
                        Case Else   'Unknown tag, skip it
                            Do Until Mid(sHTML, lCounter, 1) = ">"
                                lCounter = lCounter + 1
                            Loop
                        'End Case
                    End Select
                Case Else
                    sTemp = sTemp & Mid(sHTML, lCounter, 1)
                'End Case
            End Select
        Next
        HTMLParser = sTemp
    End Function

    ------------------

    Vincent van den Braken
    EMail: [email protected]
    ICQ: 15440110
    Homepage: http://www.azzmodan.demon.nl




  3. #3
    Guest

    Post

    yea thats fine but i want to know how to get the source code. I know how to parse it.

  4. #4
    Addicted Member
    Join Date
    Jan 1999
    Posts
    173

    Post

    OK. You will need to use the internet transfer control:

    Dim b() As Byte

    b() = Inet1.OpenURL("myurl.com",icByteArray)

    For intCount = 0 To UBound(b) - 1
    strSource = strSource & Chr(b(intCount))
    next

    The variable strSource now contains the HTML source code.

    ------------------
    "To the glory of God!"


  5. #5
    Guest

    Post

    ive tried that before but sometimes the source code is too big and it wont get it all.

  6. #6
    Guest

    Post

    I had that once to, i beleive i addaded a doevents in the inet_statechanged and that seemed to work.
    (I don't think it had anything to do with it, but i might help.)



    ------------------

    Vincent van den Braken
    EMail: [email protected]
    ICQ: 15440110
    Homepage: http://www.azzmodan.demon.nl




  7. #7
    Guest

    Post

    a do events? can you further elaborate?

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