|
挖坟,说明一下64位要改的地方'Api兼容32位与64位
#If VBA7 Then
Public Declare PtrSafe Function SetTimer Lib "user32" ( _
ByVal hwnd As Long, ByVal nIDEvent As Long, _
ByVal uElapse As Long, ByVal lpTimerFunc As LongPtr) As Long
Public Declare PtrSafe Function KillTimer Lib "user32" ( _
ByVal hwnd As Long, ByVal nIDEvent As LongPtr) As Long
#Else
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
#End If
Public Timer甲 As Long,Timer乙 As Long'用时定义定时器名称,多个就定义多个
打开定时器:Timer甲 = SetTimer(0, 1, 1000, AddressOf 过程名) 红色是定时器序号,多个的时候不能一样
打开多个:Timer乙 = SetTimer(0, 2, 1000, AddressOf 过程名) 红色是定时器序号,多个的时候不能一样
关闭定时器:Timer甲 = KillTimer(0, Timer甲)
Timer乙 = KillTimer(0, Timer乙)
其他说明,0是窗口句柄,在Office中就为0不需要改,第三个参数1000是定时时间,单位是毫秒
|
|