#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Opt("GUIOnEventMode", 1)
Dim $Start = 0
$Form1 = GUICreate("Form1", 151, 100, 192, 124)
GUISetOnEvent($GUI_EVENT_CLOSE, "_exit")
$Button1 = GUICtrlCreateButton("运行", 24, 40, 97, 37)
GUICtrlSetOnEvent(-1, "_Button1")
$Label1 = GUICtrlCreateLabel("10000", 50, 20)
GUISetState(@SW_SHOW)
While 1
Sleep(1000)
If $Start = 1 Then GUICtrlSetData($Label1, GUICtrlRead($Label1) - 1)
WEnd
Func _exit()
Exit
EndFunc ;==>_exit
Func _Button1()
If GUICtrlRead($Button1) = "运行" Then
GUICtrlSetData($Button1, "停止")
$Start = 1
Else
GUICtrlSetData($Button1, "运行")
$Start = 0
EndIf
EndFunc ;==>_Button1
|