Squirm
09-30-2001, 05:21 AM
Hi again,
I'm trying to write an crude application to allow a user to browse the internet via a connection on another PC on the LAN. Currently, I am just testing on my connected PC, with the Internet Transfer Control (ITC). I am trying to intercept the BeforeNavigate event and then get the data via ITC instead of the WebBrowser, but every time I run it, the application, and Visual Basic, lock up. Heres the code:
<pre>Private Sub Form_Load()
wbcShow.Navigate2 "http://www.another.com"
End Sub
Private Sub ITC_StateChanged(ByVal State As Integer)
If State = icResponseReceived Then
Dim vtData As Variant ' Data variable.
Dim strData As String: strData = ""
Dim bDone As Boolean: bDone = False
vtData = ITC.GetChunk(1024, icString)
DoEvents
Do While Not bDone
strData = strData & vtData
vtData = ITC.GetChunk(1024, icString)
DoEvents
If Len(vtData) = 0 Then
bDone = True
End If
Loop
Debug.Print "********" & vbCrLf & strData
End If
End Sub
Private Sub wbcShow_BeforeNavigate2(ByVal pDisp As Object, URL As Variant, Flags As Variant, _
TargetFrameName As Variant, PostData As Variant, Headers As Variant, Cancel As Boolean)
On Error GoTo FixIt
ITC.Execute CStr(URL), "GET"
Cancel = True
Exit Sub
FixIt:
ITC.Cancel
Resume
End Sub</pre>
Any help will be greatly appreciated.
Squirm images/icons/smile.gif
I'm trying to write an crude application to allow a user to browse the internet via a connection on another PC on the LAN. Currently, I am just testing on my connected PC, with the Internet Transfer Control (ITC). I am trying to intercept the BeforeNavigate event and then get the data via ITC instead of the WebBrowser, but every time I run it, the application, and Visual Basic, lock up. Heres the code:
<pre>Private Sub Form_Load()
wbcShow.Navigate2 "http://www.another.com"
End Sub
Private Sub ITC_StateChanged(ByVal State As Integer)
If State = icResponseReceived Then
Dim vtData As Variant ' Data variable.
Dim strData As String: strData = ""
Dim bDone As Boolean: bDone = False
vtData = ITC.GetChunk(1024, icString)
DoEvents
Do While Not bDone
strData = strData & vtData
vtData = ITC.GetChunk(1024, icString)
DoEvents
If Len(vtData) = 0 Then
bDone = True
End If
Loop
Debug.Print "********" & vbCrLf & strData
End If
End Sub
Private Sub wbcShow_BeforeNavigate2(ByVal pDisp As Object, URL As Variant, Flags As Variant, _
TargetFrameName As Variant, PostData As Variant, Headers As Variant, Cancel As Boolean)
On Error GoTo FixIt
ITC.Execute CStr(URL), "GET"
Cancel = True
Exit Sub
FixIt:
ITC.Cancel
Resume
End Sub</pre>
Any help will be greatly appreciated.
Squirm images/icons/smile.gif