#include <GUIConstantsEx.au3>
#include <Timers.au3>
Local $counter = 0
Local $state = 0
Local $hGUI = GUICreate("Секундомер", 300, 200)
Local $idRun = GUICtrlCreateButton("Запустить", 0, 170, 85, 25)
Local $idStop = GUICtrlCreateButton("Остановить", 100, 170, 85, 25)
Local $idUpdate = GUICtrlCreateButton("Обнулить", 200, 170, 85, 25)
Local $labtext = GUICtrlCreateLabel("0", 140,20,50,50)
GUICtrlSetFont($labtext,25)
Local $hStarttime = _Timer_Init()
GUISetState(@SW_SHOW, $hGUI)
While 1
if $state = 1 then
If _Timer_Diff($hStarttime) > 1000 Then
$hStarttime = _Timer_Init()
Clock()
endif
EndIf
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
Case $idRun
$state = 1
Case $idStop
$state = 0
Case $idUpdate
$counter = 0
GUICtrlSetData($labtext,$counter)
EndSwitch
WEnd
func Clock()
$counter = $counter + 1
GUICtrlSetData($labtext,$counter)
EndFunc
|