troubleshooting Question

Download Progress....

Avatar of B_Dorsey
B_Dorsey asked on
Visual Basic Classic
13 Comments1 Solution822 ViewsLast Modified:
I have a Timer on my page that on interval of 500ms it checks the existence of a file being downloaded...

I call my Download code, and then the timer starts and checks the existence of the file first and then the filesize... I am passing the completed size to a function that the timer is calling every 500ms and do a simple math formula Round((CurrentFileSize / CompletedSize) * 100,0) to fill a progress bar up, but it seems that the timer doesnt run while the download is happening.... then all the sudden the progress bar goes all the way to the right and starts the next download.

(download code)
Private Declare Function URLDownloadToFile Lib "urlmon" Alias "URLDownloadToFileA" (ByVal pCaller As Long, ByVal szURL As String, ByVal szFileName As String, ByVal dwReserved As Long, ByVal lpfnCB As Long) As Long
Public Function DownloadFile(URL As String, LocalFilename As String) As Boolean
    Dim lngRetVal As Long
    lngRetVal = URLDownloadToFile(0, URL, LocalFilename, 0, 0)
    If lngRetVal = 0 Then DownloadFile = True
End Function
Private Sub Form_Load()
    DownloadFile "http://www.mydomain.com/myzip.zip", "c:\downloads"
End Sub

ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 13 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 13 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros