Opt("GUIOnEventMode", 1)
Global $time = 10, $d = 1, $Button, $La
GUICreate("froml", 200, 200)
GUISetOnEvent(-3, "_Co")
$Button = GUICtrlCreateButton("暂停", 20, 20, 80, 30)
GUICtrlSetOnEvent($Button, "_Go")
$La = GUICtrlCreateLabel("123", 100, 100, 100)
GUICtrlCreateLabel("xxx", 60, 60)
GUISetState(@SW_SHOW)
AdlibRegister("_Timer", 1000)
While 1
Sleep(1000)
WEnd
Func _timer()
If $time = 0 Then Return _Ao()
Switch $d
Case 0
AdlibUnRegister("_Timer")
Case 1
$time -= 1
EndSwitch
GUICtrlSetData($La, $time)
EndFunc ;==>_timer
Func _Go()
Switch $d
Case 1
$d = 0
GUICtrlSetData($Button, "继续")
Case 0
$d = 1
GUICtrlSetData($Button, "暂停")
AdlibRegister("_Timer", 1000)
EndSwitch
EndFunc ;==>_Go
Func _Ao()
AdlibUnRegister("_Timer")
GUICtrlSetData($La, "进行中")
GUICtrlSetData($Button, "重新开始")
Dim $time = 10, $d = 0
EndFunc ;==>_Ao
Func _Co()
MsgBox(0, "123", 1)
Exit
EndFunc ;==>_Co
|