Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Option Explicit
Private Sub Form_Load()
'initialize and stage controls
ScaleMode = vbPixels
Text1.Move 5, 115, 300, 20
Text2.Move 5, 135, 300, 20
ProgressBar1.Move 5, 155, 300, 20
Command1.Move 4, 175, 83, 23
Label1.Move 100, 180, 200, 20
'Text1.Locked = True
'Text2.Locked = True
[b] Text1.Text = "[URL unfurl="true"]http://www.site.com/~test/testing/Color.rar"[/URL][/b]
[b] Text2.Text = "C:\Color.rar"[/b]
ProgressBar1.Max = 100
Command1.Caption = "Download"
Label1.Caption = "<- Click to start downlaod"
End Sub
Private Sub Command1_Click()
Inet1.Protocol = icHTTP
Command1.Enabled = False
'start download
Inet1.Execute Trim$(Text1.Text), "GET"
End Sub
Private Sub Inet1_StateChanged(ByVal State As Integer)
Dim Buffer() As Byte 'buffer for receiving data from inet control.
On Error Resume Next
Select Case State
Case icResponseCompleted
Open Text2.Text For Binary As #1 'open output file
Do
DoEvents
Buffer = Inet1.GetChunk(512, icByteArray) 'get the data chunk
If UBound(Buffer) = -1 Then Exit Do 'no more data
Put #1, , Buffer 'write data to file
ProgressBar1.Value = Seek(1) - 1 'ammount of data downloaded
Label1.Caption = "Downloaded " & ProgressBar1.Value & " bytes, " & _
FormatPercent(ProgressBar1.Value / ProgressBar1.Max)
Loop
Close
Picture = LoadPicture(Text2.Text) 'display the downloaded image
Case icResponseReceived
If LenB(Inet1.GetHeader("Content-Length")) > 0 Then
ProgressBar1.Max = CLng(Inet1.GetHeader("Content-Length")) 'total size
End If
End Select
End Sub
Option Explicit
Private Sub Form_Load()
'initialize and stage controls
ScaleMode = vbPixels
Text1.Move 5, 115, 300, 20
Text2.Move 5, 135, 300, 20
ProgressBar1.Move 5, 155, 300, 20
Command1.Move 4, 175, 83, 23
Label1.Move 100, 180, 200, 20
'Text1.Locked = True
'Text2.Locked = True
Text1.Text = "[URL unfurl="true"]http://www.rarlab.com/rar/RARaddin_48x48.theme.rar"[/URL]
Text2.Text = "C:\RARaddin_48x48.theme.rar"
ProgressBar1.Max = 100
Command1.Caption = "Download"
Label1.Caption = "<- Click to start downlaod"
End Sub
Private Sub Command1_Click()
Inet1.Protocol = icHTTP
Command1.Enabled = False
'start download
Inet1.Execute Trim$(Text1.Text), "GET"
End Sub
Private Sub Inet1_StateChanged(ByVal State As Integer)
Dim Buffer() As Byte 'buffer for receiving data from inet control.
On Error GoTo err_Inet1_StateChanged
Select Case State
Case icResponseCompleted
Open Text2.Text For Binary As #1 'open output file
Do
DoEvents
Buffer = Inet1.GetChunk(512, icByteArray) 'get the data chunk
If UBound(Buffer) = -1 Then Exit Do 'no more data
Put #1, , Buffer 'write data to file
ProgressBar1.Value = Seek(1) - 1 'ammount of data downloaded
Label1.Caption = "Downloaded " & ProgressBar1.Value & " bytes, " & _
FormatPercent(ProgressBar1.Value / ProgressBar1.Max)
Loop
Close
Case icResponseReceived
If LenB(Inet1.GetHeader("Content-Length")) > 0 Then
ProgressBar1.Max = CLng(Inet1.GetHeader("Content-Length")) 'total size
End If
End Select
exit_Inet1_StateChanged:
Exit Sub
err_Inet1_StateChanged:
Dim nextAction As Long
nextAction = MsgBox("Oh dear, an error occured. It was reported as '" & Err.Description & "'. What would you like to do?", 18)
If nextAction = 3 Then
Inet1.Cancel
Resume exit_Inet1_StateChanged
Else
Resume Next
End If
End Sub
err_Inet1_StateChanged:
Dim nextAction As Long
Debug.Print StrConv(Buffer, vbUnicode)
nextAction = MsgBox("Oh dear, an error occured. It was reported as '" & Err.Description & "'. What would you like to do?", 18)
If nextAction = 3 Then
Inet1.Cancel
Resume exit_Inet1_StateChanged
Else
Resume Next
End If
End Sub