Measure Time Remaining Of A Process
Hi All
I have a but of trouble and would like to know how to measure time remaining of a process, like copying a large file or any other lenghty process.
For example:
FolderCount = Text1.text
For I = 1 to FolderCount
Label1.caption = <time remaining>
MkDir "Test Folder" + " " + FolderCount
Next I
Suppose you have many folders to create, then how can I display, in a label, the time to completethe entire operation, during the loop, in minutes and seconds? I want to have the process count down in minutes and seconds (maybe hours too) from how long it will take initially to zero time at the end. For example the Windows copy dialog that counts down the time to copy file(s) from a start time the process will take to completion of zero seconds.
Someone suggested I should use the following code, however it seems to count up or just display to total extimated time during the entire process and does not reach zero at the end:
Dim StartTime As Date, ElapsedTime As Date, EstimatedTotalTime As Date, EstimatedTimeRemaining As Date
Dim TimePerIteration As Double
Dim I As Long, FolderCount As Long
FolderCount = Text1.Text
StartTime = Date + Time
For I = 1 To FolderCount
ElapsedTime = (Date + Time - StartTime)
TimePerIteration = ElapsedTime / I
EstimatedTotalTime = CDate((FolderCount * TimePerIteration))
EstimatedTimeRemaining = EstimatedTotalTime - ElapsedTime
Label1.Caption = "Estimated Time Remaining = " & EstimatedTimeRemaining
DoEvents
MkDir "Test Folder" & " " & I
Next I
Any help with this will be truly appreciated.
Thankx a million
Measure Time Remaining Of A Process
Phil Weber
Thank you for your reply.
I guess I will measure the time (with GetTickCount) 1 to 2 in For I = 1 to TotalNumber and then multiply the result with TotalNumber - 1. Let’s see
what happens, I am just interested in a vague result.
Have a good day
Cheerio :WAVE:
Francois