I've looked at how resume works in several examples using winsock..and inet and in each case when you stop the download and try to resume it..it takes forever for the file to get going again..sometimes it even times out..and a few other issues too
so how do you make winhttp resume downloads?
the code below is pretty straight forward..i just need to know what needs to be changed to make it support resuming
Code:Public Sub Http_OnResponseStart(ByVal Status As Long, ByVal ContentType As String) FileNumber = FreeFile mProgress = 0 mContentLength = CLng(HTTP.GetResponseHeader("Content-Length")) lblTotalSize = "Total Size : " & ListView1.ListItems(B).SubItems(4) Open FilePathName For Binary Access Write As #FileNumber End Sub Public Sub Http_OnResponseDataAvailable(Data() As Byte) If ExitMe = True Then HTTP.Abort Close #FileNumber Exit Sub End If If HTTP.Status = 404 Then Exit Sub mProgress = mProgress + UBound(Data) + 1 Percent = Format(mProgress / mContentLength * 100, "#0.00") Dim PauseTime, Start PauseTime = 0.01 ' Set duration. Start = Timer ' Set start time. Do While Timer < Start + PauseTime DoEvents ' Yield to other processes. Loop ListView1.ListItems(B).SubItems(5) = Percent & " %" Put #FileNumber, , Data End Sub Private Sub Http_OnResponseFinished() ListView1.ListItems(B).SubItems(5) = "Complete" Close #FileNumber End Sub




Reply With Quote