#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
Opt("GUIOnEventMode", 1)
#Region ### START Koda GUI section ### Form=C:\Documents and Settings\Administrator\My Documents\aaa.kxf
$Form1 = GUICreate("Form1", 438, 211, 192, 114)
GUISetOnEvent($GUI_EVENT_CLOSE, "Form1Close")
GUISetOnEvent($GUI_EVENT_MINIMIZE, "Form1Minimize")
GUISetOnEvent($GUI_EVENT_MAXIMIZE, "Form1Maximize")
GUISetOnEvent($GUI_EVENT_RESTORE, "Form1Restore")
$Label1 = GUICtrlCreateLabel("", 16, 36, 164, 28)
GUICtrlSetOnEvent(-1, "Label1Click")
$Button1 = GUICtrlCreateButton("开始任务", 216, 32, 75, 25)
GUICtrlSetOnEvent(-1, "Button1Click")
$Button2 = GUICtrlCreateButton("取消任务", 216, 80, 75, 25)
GUICtrlSetOnEvent(-1, "Button2Click")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
Global $t
While 1
Sleep(100)
WEnd
Func Button1Click()
$t=20
AdlibRegister("set",1000)
EndFunc ;==>Button1Click
Func Button2Click()
AdlibUnRegister("set")
MsgBox(4096,"","用户取消")
EndFunc ;==>Button2Click
Func set()
GUICtrlSetData($Label1, $t & "秒后重新启动计算机")
If $t < 1 Then
Run(@ComSpec & " /c " & 'shutdown -i', "", @SW_HIDE)
EndIf
$t-=1
EndFunc
Func Form1Close()
EndFunc ;==>Form1Close
Func Form1Maximize()
EndFunc ;==>Form1Maximize
Func Form1Minimize()
EndFunc ;==>Form1Minimize
Func Form1Restore()
EndFunc ;==>Form1Restore
Func Label1Click()
EndFunc ;==>Label1Click
|