Total Visual SourceBook

Total Visual SourceBook CD and Printed Manual

Microsoft Access/ Office 2016, 2013, 2010, and 2007 Version
is Shipping!

New features in Total Visual SourceBook for Access, Office 2007 and VB6

Supports Access/Office 2016, 2013, 2010 and 2007, and Visual Basic 6.0!

Separate version for Access/Office 2003, 2002, and 2000.

Separate version for:
Access 97/95


View all FMS products for Microsoft AccessAll Our Microsoft Access Products

SourceBook Info:

Why SourceBook?

 

"The code is exactly how I would like to write code and the algorithms used are very efficient and well-documented."

Van T. Dinh, Microsoft MVP

 

 

 

Microsoft Access, Office/VBA, VB6 Modules royalty-free source code libraryMicrosoft Access Modules royalty-free source code libraryMicrosoft Access VBA and VB6 Module Library Free trial of Total Visual SourceBook for Microsoft Access, Office, VB6 and VBA

Class: MMTimer in Category General VBA/VB6 : Date and Time from Total Visual SourceBook

Simulate the action of a stop watch by using a high-resolution timer, in VB6 and VBA with 32 and 64 bit Windows API calls.

This class uses a high-resolution multi-media timer to track elapsed time. This class is useful for timing user operations, or for bench-marking your applications. Because it uses the Windows multimedia timer, it uses much higher resolution than the built-in VBA/VB6 Timer function.

Procedure List

Procedure Name

Type

Description

(Declarations) Declarations Declarations and private variables for the CMMTimer class
ElapsedTime Property Get the current Elapsed Time value, scaled by the value of the ScaleFactor property
ScaleFactor Property Get the current scaling factor. A value of 1000 returns results in portions of seconds. A value of 60000 returns results in portions of minutes. A value of 1 will result in no scaling, so the value will be returned in milliseconds.
Class_Initialize Initialize Set initial values to defaults which may be overridden with property settings
ResumeTimer Method Resumes a timing operation which was paused with the StopTimer method. If the timer was not started already, it is started automatically.
StartTimer Method Starts a timing operation. The value of ElapsedTime is reset before beginning.
StopTimer Method Stops the timer. Current elapsed time value is not reset.
GetCurrentElapsedTime Private Get the elapsed time since the timer was last started

Example Code for Using Class: MMTimer

' Example of the CMMTimer class
'
' To try this example, do the following:
' 1. Create a new form
' 2. Add the following controls to the form:
' 3. Add a command button called 'cmdStart'
' 4. Add a command button called 'cmdStop'
' 5. Add a command button called 'cmdResume'
' 6. Paste all the code from this example to the new form's module
' 7. Run the form, test the Stop Watch

' Declarations section code
Private mMMTimer As CMMTimer

Private Sub cmdStart_Click()
  Set mMMTimer = New CMMTimer

  ' Return results in fractions of seconds
  mMMTimer.ScaleFactor = 1000
  Debug.Print "Started: " & Now()
  mMMTimer.StartTimer
End Sub

Private Sub cmdStop_Click()
  mMMTimer.StopTimer
  Debug.Print "Elapsed: " & mMMTimer.ElapsedTime
End Sub

Private Sub cmdResume_Click()
  Debug.Print "Resumed: " & Now()
  mMMTimer.ResumeTimer
End Sub

Private Sub Form_Load()
  Me.cmdStart.Caption = "Start"
  Me.cmdStop.Caption = "Stop"
  Me.cmdResume.Caption = "Resume"
End Sub

Microsoft Access Module LibraryOverview of Total Visual SourceBook

The source code in Total Visual SourceBook includes modules and classes for Microsoft Access, Visual Basic 6 (VB6), and Visual Basic for Applications (VBA) developers. Easily add this professionally written, tested, and documented royalty-free code into your applications to simplify your application development efforts.

Additional Resources