Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

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
Avatar of nffvrxqgrcfqvvc
Commented:
This problem has been solved!
Unlock 1 Answer and 13 Comments.
See Answers