#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Local $hGUI = GUICreate("Выключение ос по таймеру", 500, 200)
Local $idinput = GUICtrlCreateInput("1000", 0, 0, 500, 25)
Local $idbutton1 = GUICtrlCreateButton("Включить таймер", 20, 50, 185, 25)
GUISetState(@SW_SHOW, $hGUI)
Local $hTimer = TimerInit()
Local $state = 0
While 1
$msg = GUIGetMsg()
if $msg = $GUI_EVENT_CLOSE then
ExitLoop
endif
if $msg = $idbutton1 Then
$state = 1
$hTimer = TimerInit()
EndIf
if $state = 1 then
Local $iDiff = TimerDiff($hTimer)
if ($iDiff >Number (GUICtrlRead($idinput)) ) then
Shutdown(1)
Endif
EndIf
WEnd
|