It took me quite a while to find a well encapsulated, and easy to use API Timer.
So I thought I would share it with you guys/gals.
The author does not wish his code replicated, so I will provide a link instead.
Paradoxes
There is a download, and the web page also shows how to call it.
Here is my tweaked example for calling it.
VB Code:
Option Explicit Dim WithEvents Alarm As AlarmClass 'Public Const MIN_ONE As Long = 60000 'Put this in AlarmModule.bas Private Sub Alarm_Alarm() Print "Event Fired " & Time MsgBox "Alarm!" End Sub Private Sub cmdSetAlarm_Click() 'Alarm.SetAlarm 5000 Print "Start " & Time Alarm.SetAlarm MIN_ONE * 2 End Sub Private Sub cmdCancelAlarm_Click() Alarm.CancelAlarm End Sub Private Sub Form_Load() Set Alarm = New AlarmClass End Sub Private Sub Form_Unload(Cancel As Integer) Set Alarm = Nothing End Sub
I believe this should be in the Codebank, but I am unsure if there is a different method of submitting it ?




Reply With Quote