Private Declare Function GetTickCount Lib "kernel32" () As Long Dim TMR_Enabled As Boolean Private Sub RunTimer(TMR_Interval) TMR_Enabled = True Dim Cur_Time As Long Dim Next_Time As Long Cur_Time = GetTickCount Next_Time = Cur_Time + TMR_Interval Do While TMR_Enabled If Next_Time <= Cur_Time Then TIMER_SUB Next_Time = Cur_Time + TMR_Interval End If Cur_Time = GetTickCount DoEvents Loop End Sub private sub TIMER_SUB() ' code a executer ici End sub
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionPrivate Declare Function GetTickCount Lib "kernel32" () As Long Dim TMR_Enabled As Boolean Private Sub RunTimer(TMR_Interval) TMR_Enabled = True Dim Cur_Time As Long Dim Next_Time As Long Cur_Time = GetTickCount Next_Time = Cur_Time + TMR_Interval Do While TMR_Enabled If Next_Time <= Cur_Time Then TIMER_SUB Next_Time = Cur_Time + TMR_Interval End If Cur_Time = GetTickCount DoEvents Loop End Sub private sub TIMER_SUB() ' code a executer ici End sub