十年前的帖子都被你翻出来了……#include <Timers.au3>
Local $hGUI = GUICreate('倒计时+暂停', 350, 100)
Global $iBtn = GUICtrlCreateButton('暂停/继续', 10, 10, 100, 22)
Global $iLabel = GUICtrlCreateLabel('10', 120, 40, 100, 30, 0x01)
GUICtrlSetFont(-1, 20, 800, 0, '微软雅黑')
GUISetState()
Global $iTotal = 10, $iCount = $iTotal
Global $bIsPause = False
Global $iTimer = _Timer_SetTimer($hGUI, 1000, '_DJS')
While 1
Switch GUIGetMsg()
Case -3
ExitLoop
Case $iBtn
$bIsPause = Not $bIsPause
EndSwitch
WEnd
_Timer_KillTimer($hGUI, $iTimer)
GUIDelete()
Func _DJS($hWnd, $iMsg, $iIDTimer, $iTime)
If $bIsPause Then Return
$iCount -= 1
GUICtrlSetData($iLabel, $iCount)
If $iCount = 0 Then
_Timer_KillTimer($hGUI, $iTimer)
GUICtrlSetState($iBtn, 32)
MsgBox(0, '', '时间到')
EndIf
EndFunc ;==>_DJS
|