-
Is there a timer which can keep time for more than just a few seconds. The generic VB timer has a low maximum time and IE's timer is barely better. I'm thinking in minutes. Or, is there a component which keeps track of how long it's been since an event occured? Either one would work for me, thanks for any help you can give.
-
Timer
I think you could use
Timer
to Measure how many seconds have past since the starting and ending of somethin'
like this
Code:
Var BeginProgress As Long, EndProgress As Long
'Before the Progress Starts, use this
BeginProgress = Timer
'The Start The Progress
Call Progress
'After the Progress call
EndProgress As Long
'Calculate in seconds
MsgBox LTrim(Int(EndProgress - BeginProgress) * 100 + 0.5) / 100
Hope that's what you wanted!
-
Perhaps this will do well, I use it.
<Declarations>
Global TimeStart as Date
<in routine you wish to time>
Static TimeStart as Date 'Global & Static so you can check it from anywhere.
'place this just before you call the function/sub you want to time
TimeStart = now
'after it's finished use this to determine how long it took in seconds
Label1.Caption = "Processed file in " & DateDiff("s", TimeStart, Now) & " second(s)"
-
The API function GetTickCount gives the time in milliseconds, elapsed since system start up (maximum of 49.7 days). You can manipulate it to be used for keeping track of longer durations of time.
-
-
Try this example using GetTickCount
Code:
Private Declare Function GetTickCount Lib "kernel32" () As Long
Sub Pause(dwInterval As Long)
Start = GetTickCount
Do While GetTickCount < Start + dwInterval
DoEvents
Loop
End Sub
Private Sub Command1_Click()
'Pause program for 1 hour
Pause 36000000
MsgBox ("1 hour has passed by")
End Sub
-
Thanks!!
Thanks, Mega, that's exactly what I needed. It'll be really useful.