I need a way to download a file from the internet to a local file, while allowing the program to continue processing.
I want to use this processing time to update 2 progress bars (file and overall).
Couldnt seem to get winsock to do anything at all, but I can get this to do at least something, although the file is always corrupt.
Here is the code I've used (mainly from MSDN)
Any suggestions or should I just take a bullet ?Code:Private Sub Inet1_StateChanged(ByVal State As Integer) Dim vtData As Variant ' Data variable. Dim intFile As Integer intFile = FreeFile() Select Case State Case icResponseCompleted ' 12 ' Open a file to write to. Open "c:\saved.zip" For Binary Access Write As #intFile ' Get the first chunk. vtData = Inet1.GetChunk(1024, icByteArray) Do While LenB(vtData) > 0 Put #intFile, , vtData ' Get next chunk. vtData = Inet1.GetChunk(1024, icByteArray) Loop Put #intFile, , vtData Close #intFile MsgBox "Download Complete" End Select End Sub
Thanks for any knowledge you can share.




Reply With Quote