Class: Hourglass in Category Microsoft Visual Basic 6 : Application Techniques from Total Visual SourceBook

Wrapper class that implements an alternative way to show an hourglass in VB6.

One of the problems that can arise when using an hourglass is not setting the cursor back to the default. This class avoids that problem by automatically setting the cursor back to the default when it terminates.

Procedure Name Type Description
(Declarations) Declarations Declarations and private variables for the CHourglass class.
Value Property Get whether the cursor is an hourglass.
Class_Terminate Terminate Reset the cursor to the default.
' Example of CHourglass
' To try this example, do the following:
' 1. Create a new form
' 2. Add a command button named 'cmdTest'
' 3. Paste all the code from this example to the new form's module
' 4. Run the form

Private Sub cmdTest_Click()

  Dim dblStart As Double
  Dim clsHourglass As CHourglass

  Set clsHourglass = New CHourglass

  clsHourglass.Value = True

  ' Simulate a long operation by looping for 2 seconds
  dblStart = Timer

  Do Until dblStart + 2 < Timer

  MsgBox "Done!"

  ' You may either explicitly set the value to false, or just wait for the variable to go out of scope,
  ' in which case the hourglass is automatically turned off
  clsHourglass.Value = False

End Sub

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.

Total Visual SourceBook is written for the needs of a developer using a source code library covering the many challenges you face. Countless developers over the years have told us they learned some or much of their development skills and tricks from our code. You can too!

Additional Resources

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 and VB6

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

View all FMS products for Microsoft Access All Our Microsoft Access Products


Reader Choice Award for MS Access Source Code Library
Reader Choice

"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

SourceBook Info

Additional Info




Free Product Catalog from FMS