| 回复 1# solox 
 郁闷,核心中的主循环不用,一直闲着,后面又说太忙,处理不了..
 
 #include <GUIConstants.au3>
Opt("GUIOnEventMode", 1)
Global $start = 0
$Form = GUICreate("Test",420,200)
$button1 = GUICtrlCreateButton("开始循环",15,10)
$button2 = GUICtrlCreateButton("停止循环",15,40)
GUISetOnEvent($GUI_EVENT_CLOSE,"_FormClose")
GUICtrlSetOnEvent($button1,"_Start")
GUICtrlSetOnEvent($button2,"_Stop")
GUISetState(@SW_SHOW)
 
While 1
         While $start
                ConsoleWrite(Random()&@LF)
                                Sleep(10)
                wEnd
                Sleep(10)
WEnd
 
Func _FormClose()
        GUIDelete($Form)
        Exit
EndFunc
 
Func _Start()
        $start = 1
EndFunc
 
Func _Stop()
        $start = 0
EndFunc
 |