Option Explicit
Public Declare Function SetTimer _
Lib 'user32' ( _
ByVal hwnd As Long, _
ByVal nIDEvent As Long, _
ByVal uElapse As Long, _
ByVal lpTimerfunc As Long) _
As Long
Public Declare Function KillTimer _
Lib 'user32' ( _
ByVal hwnd As Long, _
ByVal nIDEvent As Long) _
As Long
'========== Déclarations Public ========================
Public TimerID As Long 'Activer avec cet ID
Public TimerActive As Boolean 'Est le minuteur actif
'=======================================================
Public Sub ActiverTimer(ByVal sec As Long)
sec = sec * 1000
If TimerActive Then Call DesactiverTimer
On Error Resume Next
TimerID = SetTimer(0, 0, sec, AddressOf Timer_CallBackFunction)
TimerActive = True
End Sub
Public Sub DesactiverTimer()
KillTimer 0, TimerID
End Sub
Public Sub Timer_CallBackFunction(ByVal hwnd As Long, ByVal uMsg As Long, ByVal idevent As Long, _
ByVal Systime As Long)
PROG.CommandButton3.Caption = Format(Now, 'Long Time')
PROG.DATEnow.Caption = 'Nous somme le : ' & Format(Date, 'Long Date')
End Sub