窗体代码:
Option Explicit
Private Declare Function timeKillEvent Lib "winmm.dll" (ByVal uID As Long) As Long
Private Declare Function timeSetEvent Lib "winmm.dll" (ByVal uDelay As Long, ByVal uResolution As Long, ByVal lpFunction As Long, ByVal dwUser As Long, ByVal uFlags As Long) As Long
Dim p As Long
Private Const TIME_周期 As Long = 1
Private Const TIME_一次性 As Long = 0
Private Sub Form_DblClick()
timeKillEvent p
p = 0
End Sub
Private Sub Form_Load()
p = timeSetEvent(300000, 10, AddressOf TimeProc, 1, TIME_一次性)
Debug.Print timeGetTime
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
If p Then timeKillEvent p: p = 0: Cancel = True: Timer1.Enabled = True
End Sub
Private Sub Timer1_Timer()
Timer1.Enabled = False
Unload Me
End Sub
[/font]
模块代码:
Option Explicit
Public Declare Function timeGetTime Lib "winmm.dll" () As Long
Sub TimeProc(ByVal uID As Long, ByVal uMsg As Long, ByVal dwUser As Long, ByVal dw1 As Long, ByVal dw2 As Long)
Debug.Print timeGetTime
End Sub
目前有0条回应
Comment
Trackback