|
|
Title | Use the Internet Transfer Control's Execute method and GetChunk to download a file |
Keywords | Inet, Internet Transfer Control, GetChunk, download |
Categories | Controls, Files and Directories, Utilities |
|
|
Begin the download by calling the Internet Transfer Control's Execute method with the GET command.
|
|
Private Sub cmdGet_Click()
Inet1.Execute txtFile.Text, "GET"
End Sub
|
|
In the control's StateChanged event handler, look for the icResponseCompleted state. Use GetChunk to retrieve the returned data.
|
|
Private Sub Inet1_StateChanged(ByVal State As Integer)
Dim var_data As Variant
Dim str_data As String
If State = icResponseCompleted Then
' Get the first chunk.
var_data = Inet1.GetChunk(1024, icString)
str_data = str_data & var_data
' Get the rest of the chunks.
Do
DoEvents
var_data = Inet1.GetChunk(1024, icString)
If Len(var_data) = 0 Then Exit Do
str_data = str_data & var_data
Loop
txtResults.Text = str_data
End If
End Sub
|
|
|
|
|
|