PDA

Click to See Complete Forum and Search --> : Making a webbrowser without using the webrowser componet


Jan 20th, 2000, 11:56 AM
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?

Jan 20th, 2000, 05:36 PM
Here is an exmple i wrote some time ago:

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: azzmodan@azzmodan.demon.nl
ICQ: 15440110 (http://www.icq.com/15440110)
Homepage: http://www.azzmodan.demon.nl

Jan 21st, 2000, 02:18 AM
yea thats fine but i want to know how to get the source code. I know how to parse it.

vbsquare
Jan 21st, 2000, 05:25 PM
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!"

Jan 22nd, 2000, 09:12 AM
ive tried that before but sometimes the source code is too big and it wont get it all.

Jan 22nd, 2000, 12:50 PM
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: azzmodan@azzmodan.demon.nl
ICQ: 15440110 (http://www.icq.com/15440110)
Homepage: http://www.azzmodan.demon.nl

Jan 23rd, 2000, 04:17 AM
a do events? can you further elaborate?