#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
Opt("GUIOnEventMode", 1)
#region ### START Koda GUI section ### Form=
Local $sHOUR = "00|01|02|03|04|05|06|07|08|09|10|12|13|14|15|16|17|18|19|20|21|22|23|24"
Local $sMIN = "00|01|02|03|04|05|06|07|08|09|10|12|13|14|15|16|17|18|19|20|21|22|23|24|" & _
"25|26|27|28|29|30|31|32|33|34|35|36|37|38|39|40|41|42|43|44|45|46|47|48|" & _
"49|50|51|522|53|54|55|56|57|58|59"
$Form1 = GUICreate("定时关机", 187, 116, 302, 181)
GUISetOnEvent($GUI_EVENT_CLOSE, "Form1Close")
$Label1 = GUICtrlCreateLabel("时间:", 16, 40, 31, 17)
$Label2 = GUICtrlCreateLabel(":", 104, 40, 31, 17)
$Combo1 = GUICtrlCreateCombo("", 55, 37, 41, 25, BitOR($GUI_SS_DEFAULT_COMBO, 0x0003))
GUICtrlSetData(-1, $sHOUR, "00")
$Combo2 = GUICtrlCreateCombo("", 120, 37, 41, 25, BitOR($GUI_SS_DEFAULT_COMBO, 0x0003))
GUICtrlSetData(-1, $sMIN, "00")
$Button1 = GUICtrlCreateButton("定时关机", 16, 80, 55, 25)
GUICtrlSetOnEvent(-1, "Button1Click")
$Button2 = GUICtrlCreateButton("取消关机", 104, 80, 55, 25)
GUICtrlSetOnEvent(-1, "Button2Click")
GUISetState(@SW_SHOW)
#endregion ### END Koda GUI section ###
While 1
Sleep(10)
WEnd
Func Button1Click()
$time = GUICtrlRead($Combo1) & ":" & GUICtrlRead($Combo2)
Run(@ComSpec & " /c " & 'at ' & $time & ' Shutdown -s', "", @SW_HIDE)
EndFunc ;==>Button1Click
Func Button2Click()
Run(@ComSpec & " /c " & 'Shutdown -a', "", @SW_HIDE)
EndFunc ;==>Button2Click
Func Form1Close()
Exit
EndFunc ;==>Form1Close
|