Attribute VB_Name = "modMT5"
Option Explicit

' Guide to Perplexed: MT5
' Copyright (c) 1997 by Desaware Inc. All Rights Reserved

' Timer identifier
Dim TimerID&

' Object for this timer
Dim TimerObject As ClassMT5
Declare Function SetTimer Lib "user32" (ByVal hwnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long) As Long
Declare Function KillTimer Lib "user32" (ByVal hwnd As Long, ByVal nIDEvent As Long) As Long


Public Sub StartTimer(callingobject As ClassMT5)
   Set TimerObject = callingobject
   TimerID = SetTimer(0, 0, 100, AddressOf TimerProc)
End Sub

' Callback function
Public Sub TimerProc(ByVal hwnd&, ByVal msg&, ByVal id&, ByVal currentime&)
   Call KillTimer(0, TimerID)
   TimerID = 0
   TimerObject.TimerExpired
   ' And clear the object reference so it can delete
   Set TimerObject = Nothing
End Sub

