这个问题我在写贪食蛇的时候遇到过,可以这样
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
Opt("GUIOnEventMode", 1)
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 205, 76, 193, 125)
GUISetOnEvent($GUI_EVENT_CLOSE, "Form1Close")
$Label1 = GUICtrlCreateLabel("0", 16, 16, 108, 41)
$Button1 = GUICtrlCreateButton("循环", 136, 8, 57, 25, 0)
GUICtrlSetOnEvent(-1, "Button1Click")
$Button2 = GUICtrlCreateButton("暂停", 136, 40, 57, 25, 0)
GUICtrlSetOnEvent(-1, "Button2Click")
GUISetState(@SW_SHOW)
#EndRegion ### START Koda GUI section ### Form=
While 1
Sleep(100)
WEnd
Func Button1Click()
AdlibEnable("test",100)
EndFunc ;==>Button1Click
Func Button2Click()
AdlibDisable()
EndFunc ;==>Button2Click
Func Form1Close()
Exit
EndFunc ;==>Form1Close
Func test()
GUICtrlSetData($Label1, GUICtrlRead($Label1) + 1)
EndFunc
|