不知道这样行不行 Option ExplicitPublic lTimerId As Long 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 LongPrivate Sub TimerProc(ByVal lHwnd As Long, ByVal lMsg As Long, ByVal lTimerId As Long, ByVal lTime As Long) '处理程序 End SubPublic Sub StartTimer(lMinute As Long) lTimerId = SetTimer(0, 0, lMinute, AddressOf TimerProc) End SubPublic Function StopTimer(lTimerId As Long) As Long StopTimer = KillTimer(0, lTimerId) End Function
Option ExplicitPublic lTimerId As Long
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 LongPrivate Sub TimerProc(ByVal lHwnd As Long, ByVal lMsg As Long, ByVal lTimerId As Long, ByVal lTime As Long)
'处理程序
End SubPublic Sub StartTimer(lMinute As Long)
lTimerId = SetTimer(0, 0, lMinute, AddressOf TimerProc)
End SubPublic Function StopTimer(lTimerId As Long) As Long
StopTimer = KillTimer(0, lTimerId)
End Function