#include <GUIConstants.au3>
GUICreate("倒计时关机", 250, 150,180,80)
$Button1 = GUICtrlCreateButton("确定(&Y)", 30, 110, 73, 25, 0)
$Button2 = GUICtrlCreateButton("退出(&X)", 150, 110, 73, 25, 0)
GUISetState(@SW_SHOW)
$Label = GUICtrlCreateLabel('倒计时: 10 秒',28,45,250,40)
GUICtrlSetFont(-1, 26, 400, 0, "MS Sans Serif")
Local $C = 0, $w = 10, $T1 = TimerInit()
While 1
If GUIGetMsg() = $GUI_EVENT_CLOSE Then Exit
$T2 = Int(TimerDiff($T1) / 1000)
If $T2 >= $w Then ExitLoop
If $T2 > $C Then
$C = $T2
GUICtrlSetData($Label , '倒计时: ' & $w - $T2 & ' 秒')
EndIf
$nMsg = GUIGetMsg()
Switch $nMsg
Case $Button1
ExitLoop
Case $Button2
Exit
EndSwitch
WEnd
_guanji()
Exit
Func _guanji()
shutdown(4+8)
EndFunc ;==>_timer
|