凑下热闹
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Timers.au3>
$Form1 = GUICreate("倒计时", 340, 194, 192, 124)
$Button1 = GUICtrlCreateButton("点击暂停(10)", 72, 40, 185, 97)
GUICtrlSetFont(-1, 24, 800, 0, "MS Sans Serif")
$Timer = _Timer_SetTimer($Form1, 1000, "update")
GUISetState(@SW_SHOW)
Global $Check = 10
While 1
$Msg = GUIGetMsg()
Switch $Msg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
If GUICtrlRead($Button1) = "暂停中" Then
$Timer = _Timer_SetTimer($Form1, 1000, "update")
Else
_Timer_KillTimer($Form1, $Timer)
GUICtrlSetData($Button1,"暂停中")
EndIf
EndSwitch
Sleep(100)
WEnd
Func update($hWnd, $Msg, $iIDTimer, $dwTime)
$Check -= 1
GUICtrlSetData($Button1, "点击暂停(" & $Check & ")")
If $Check = 0 Then
_Timer_KillTimer($Form1, $Timer)
Exit MsgBox(64, "提示", "倒计时结束")
EndIf
EndFunc ;==>update
|