Bonjour à toutes et tous
Sur le forum, j'ai recuperé un chrono qui correspond à mes besoin, un signal sonor bip à 30s du temps final
si je laisse le chrono aller jusqu'au temps selectionné le bip s'arret bien mais si je stop le chono avant la fin du bip celui-ci repart ou il s'est arreté à la remis en marche du chrono . qu'elle modif à apporter dans le code
Const SIGNAL As Long = 30 'délai en secondes du beep avant la fin du chrono ///
'gestion chrono
Private Declare Function SetTimer Lib "User32" _
(ByVal hWnd As Long, ByVal nIDEvent As Long, _
ByVal uElapse As Long, ByVal lpTimerFunc As Long) As Long
Private Declare Function KillTimer Lib "User32" _
(ByVal hWnd As Long, ByVal nIDEvent As Long) As Long
Public Compteur As Long '///
Public LimiteStop As Long '###
Dim TimerID As Long
Sub TestChrono()
'lancement Userform
UserForm1.Show
End Sub
Sub TimerOff()
'arret du chrono
KillTimer 0, TimerID
End Sub
Sub TimerOn(Interval As Long)
' en relation avec le bouton start du chrono
TimerID = SetTimer(0, 0, Interval, AddressOf Chrono)
End Sub
Sub Chrono()
Dim H, DS
DS = CByte(UserForm1.Label2.Caption) + 1
UserForm1.Label2.Caption = CStr(DS)
If (DS Mod 10) = 0 Then
Compteur = Compteur + 1 '///
If Compteur + SIGNAL >= CLng(UserForm1.Label7) Then Beep '###
H = TimeValue(UserForm1.Label1.Caption) + TimeSerial(0, 0, 1)
UserForm1.Label1.Caption = Format(H, "hh:nn:ss")
UserForm1.Label2.Caption = "0"
If Compteur = CLng(UserForm1.Label7) Then '###
Compteur = 0 '///
Call TimerOff '///
End If '///
End If
End Sub
merci
phil69
Sur le forum, j'ai recuperé un chrono qui correspond à mes besoin, un signal sonor bip à 30s du temps final
si je laisse le chrono aller jusqu'au temps selectionné le bip s'arret bien mais si je stop le chono avant la fin du bip celui-ci repart ou il s'est arreté à la remis en marche du chrono . qu'elle modif à apporter dans le code
Const SIGNAL As Long = 30 'délai en secondes du beep avant la fin du chrono ///
'gestion chrono
Private Declare Function SetTimer Lib "User32" _
(ByVal hWnd As Long, ByVal nIDEvent As Long, _
ByVal uElapse As Long, ByVal lpTimerFunc As Long) As Long
Private Declare Function KillTimer Lib "User32" _
(ByVal hWnd As Long, ByVal nIDEvent As Long) As Long
Public Compteur As Long '///
Public LimiteStop As Long '###
Dim TimerID As Long
Sub TestChrono()
'lancement Userform
UserForm1.Show
End Sub
Sub TimerOff()
'arret du chrono
KillTimer 0, TimerID
End Sub
Sub TimerOn(Interval As Long)
' en relation avec le bouton start du chrono
TimerID = SetTimer(0, 0, Interval, AddressOf Chrono)
End Sub
Sub Chrono()
Dim H, DS
DS = CByte(UserForm1.Label2.Caption) + 1
UserForm1.Label2.Caption = CStr(DS)
If (DS Mod 10) = 0 Then
Compteur = Compteur + 1 '///
If Compteur + SIGNAL >= CLng(UserForm1.Label7) Then Beep '###
H = TimeValue(UserForm1.Label1.Caption) + TimeSerial(0, 0, 1)
UserForm1.Label1.Caption = Format(H, "hh:nn:ss")
UserForm1.Label2.Caption = "0"
If Compteur = CLng(UserForm1.Label7) Then '###
Compteur = 0 '///
Call TimerOff '///
End If '///
End If
End Sub
merci
phil69