I'm using the ProgressBar control to show the download progress for various CAB files downloaded from various servers. I will need a progress bar to show that the program is not dead but I don't know how to link it. Here's the DownloadFile sub:
B4X:
Sub DownloadFile (LocalFile,URL)
Response.New1
Request.New1(URL)
Response.Value = Request.GetResponse 'Launch the request and get the response.
Response.Value = Request.GetResponse 'Launch the request and get the response.
Reader.New1(Response.GetStream,true) 'Use a BinaryFile object to read the data from the Response stream.
FileOpen(c1,LocalFile,cRandom)
Writer.New1(c1,false)
Dim buffer(4096) As byte
count = Reader.ReadBytes(buffer(),4096)
Do While count > 0
Writer.WriteBytes2(buffer(),0,count)
count = Reader.ReadBytes(buffer(),4096)
Loop
FileClose(c1)
Response.Close 'Close the Response stream.
End Sub 'Get files