F
Franco
I'm using VB 2005. I want to use the Inet control to get a file from a
server via HTTP.
The code to send the request is:
AxInet1.Execute("http://www.thewebsite.com/thefile.zip", "GET", "", "")
And the code to handle the response event is:
Private Sub AxInet1_StateChanged(ByVal sender As Object, ByVal e As
AxInetCtlsObjects.DInetEvents_StateChangedEvent) Handles
AxInet1.StateChanged
Dim vtData As Object
Dim intFile As Integer
intFile = FreeFile()
If (e.state = InetCtlsObjects.StateConstants.icResponseReceived)
Then
FileOpen(intFile, "thefile.zip", OpenMode.Binary,
OpenAccess.Write)
vtData = AxInet1.GetChunk(1024,
InetCtlsObjects.DataTypeConstants.icByteArray)
Do While Len(vtData) > 0
FilePutObject(intFile, vtData)
vtData = AxInet1.GetChunk(1024,
InetCtlsObjects.DataTypeConstants.icByteArray)
Loop
FilePutObject(intFile, vtData)
FileClose(intFile)
End If
End Sub
I get the "response received" event, but when I call the first
"GetChunk", it just gets stuck there. What am I doing wrong? Thanks in
advance for any suggestions.
server via HTTP.
The code to send the request is:
AxInet1.Execute("http://www.thewebsite.com/thefile.zip", "GET", "", "")
And the code to handle the response event is:
Private Sub AxInet1_StateChanged(ByVal sender As Object, ByVal e As
AxInetCtlsObjects.DInetEvents_StateChangedEvent) Handles
AxInet1.StateChanged
Dim vtData As Object
Dim intFile As Integer
intFile = FreeFile()
If (e.state = InetCtlsObjects.StateConstants.icResponseReceived)
Then
FileOpen(intFile, "thefile.zip", OpenMode.Binary,
OpenAccess.Write)
vtData = AxInet1.GetChunk(1024,
InetCtlsObjects.DataTypeConstants.icByteArray)
Do While Len(vtData) > 0
FilePutObject(intFile, vtData)
vtData = AxInet1.GetChunk(1024,
InetCtlsObjects.DataTypeConstants.icByteArray)
Loop
FilePutObject(intFile, vtData)
FileClose(intFile)
End If
End Sub
I get the "response received" event, but when I call the first
"GetChunk", it just gets stuck there. What am I doing wrong? Thanks in
advance for any suggestions.