OptionExplicit
PrivateDeclareFunctiontimeKillEventLib"winmm.dll"(ByValuIDAsLong)AsLong
PrivateDeclareFunctiontimeSetEventLib"winmm.dll"(ByValuDelayAsLong,ByValuResolutionAsLong,ByVallpFunctionAsLong,ByValdwUserAsLong,ByValuFlagsAsLong)AsLong
DimpAsLong
PrivateConstTIME_周期AsLong=1
PrivateConstTIME_一次性AsLong=0
PrivateSubForm_DblClick()
timeKillEventp
p=0
EndSub
PrivateSubForm_Load()
p=timeSetEvent(300000,10,AddressOfTimeProc,1,TIME_一次性)
Debug.PrinttimeGetTime
EndSub
PrivateSubForm_QueryUnload(CancelAsInteger,UnloadModeAsInteger)
IfpThentimeKillEventp:p=0:Cancel=True:Timer1.Enabled=True
EndSub
PrivateSubTimer1_Timer()
Timer1.Enabled=False
UnloadMe
EndSub
[/font]
模块代码:
OptionExplicit
PublicDeclareFunctiontimeGetTimeLib"winmm.dll"()AsLong
SubTimeProc(ByValuIDAsLong,ByValuMsgAsLong,ByValdwUserAsLong,ByValdw1AsLong,ByValdw2AsLong)
Debug.PrinttimeGetTime
EndSub