From anonymous, 4 Weeks ago, written in Visual Basic.
This paste will go to its last resting place in 1 Second.
Embed
  1. Private Declare Function SetTimer Lib "user32" ( _
  2.     ByVal hWnd As Long, ByVal nIDEvent As Long, _
  3.     ByVal uElapse As Long, ByVal lpTimerFunc As Long) As Long
  4.  
  5. Private Declare Function KillTimer Lib "user32" ( _
  6.     ByVal hWnd As Long, ByVal nIDEvent As Long) As Long
  7.  
  8.  
  9. Public Event OnTimer()
  10.  
  11. Private TimerID As Long
  12.  
  13. 'Start timer
  14. Public Sub Startit(IntervalMs As Long)
  15.     TimerID = SetTimer(Application.hWndAccessApp, ObjPtr(Me), IntervalMs, AddressOf Timers.TimerProc)
  16. End Sub
  17.  
  18. 'Stop timer
  19. Public Sub Stopit()
  20.     If TimerID <> -1 Then
  21.         KillTimer 0&, TimerID
  22.         TimerID = 0
  23.     End If
  24. End Sub
  25.  
  26.  
  27. 'Trigger Public event
  28. Public Sub RaiseTimerEvent()
  29.     RaiseEvent OnTimer
  30. End Sub