VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "EventTimerClass"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
Dim cFrm As Form1
Dim WithEvents eTimer As Timer
Attribute eTimer.VB_VarHelpID = -1
Dim totalInterval As Double
Dim T1 As Double
Dim Counting As Boolean

Event Minute()
Event Hour()

Public Sub StartCounting()
    T1 = Time
    Counting = True
End Sub

Public Sub StopCounting()
    totalInterval = totalInterval + Time - T1
    Counting = False
End Sub

Property Get ElapsedTime() As Double
    ElapsedTime = totalInterval
End Property

Public Sub ResetTimer()
    totalInterval = 0
End Sub

Private Sub Class_Initialize()
    Set cFrm = New Form1
    Load cFrm
    Set eTimer = cFrm.Timer1
End Sub

Private Sub eTimer_Timer()
Static seconds As Long
Static minutes As Long
Static hours As Long
Dim RaiseMinutes As Boolean, RaiseHours As Boolean

    If Not Counting Then Exit Sub
    RaiseMinutes = False
    RaiseHours = False
    seconds = seconds + eTimer.Interval / 1000
    If seconds = 60 Then
        minutes = minutes + 1
        seconds = 0
        RaiseMinutes = True
        If minutes = 60 Then
            hours = hours + 1
            minutes = 0
            RaiseHours = True
        End If
    End If
    If RaiseHours Then
        RaiseEvent Hour
    ElseIf RaiseMinutes Then
        RaiseEvent Minute
    End If
End Sub
