Komplet (men ikke testet) eksempel:
' øverst i kode-området ("(generel)")
dim var_data as variant
dim strData as string ' de data der downloades, smides i strData
dim tmp as string ' midlertidigt data
Private Sub cmdDownload_Click()
Inet1.Execute "
http://www.minside/versionfil.asp", "GET"
End Sub
Private Sub Inet1_StateChanged(ByVal State As Integer)
On Error GoTo EOS
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
tmp = Mid(strData, InStr(strData, "version=") + Len("version="))
tmp = Mid(tmp, InStr(tmp, "=") + 1, InStr(tmp, vbCrLf))
msgbox "versionen er: " & tmp
EOS:
If Err.Number <> 0 Then Msgbox Err.Number & " - " & Err.Description
end sub
Der skal bruges:
- Control: Microsoft Internet Transfer Control (f.eks. version 6.0), med navnet "Inet1".
- CommandButton: med navnet "cmdDownload"