VBcoders Browse New Submit Contact Sign In

No account? Register free

Forgot password?

clsTimer

John Lambert  (2 Submissions)   Debugging and Error Handling   Visual Basic 3.0   Unknown Difficulty   Wed 3rd February 2021

This code keeps a count in milliseconds of how long it takes between calls of StartTimer and StopTimer or Elapsed.

Inputs
None.

Assumes
Make a class called clsTimer and paste this in there. Call order is something like: Dim t1 as new clsTimer t1.StartTimer 'do something that takes a while Debug.Print "Right now, current elapsed = " & t2.Elapsed 'do something else? t2.StopTimer Debug.Print "Total elapsed = " & t2.Elapsed

Returns
.Elapsed returns the number of milliseconds between calls to .StartTimer and .StopTimer. If .StopTimer hasn't been called, it returns the number of milliseconds since .StartTimer was called.

Side Effects
No side effects.

API Declarations
Private Declare Function GetTickCount Lib "kernel32" () As Long

Rate clsTimer (5(5 Vote))
clsTimer.bas

clsTimer Comments

No comments yet — be the first to post one!

Post a Comment

0/1000 characters