[已解决]请教如何终止程序内某个Func参数
本帖最后由 zhaoceshi 于 2017-2-27 10:13 编辑如题,代码如下。
怎么可以写成按下F3就会停止func ZK 这个参数而不退出程序呢。#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 615, 438, 192, 124)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
HotKeySet("{esc}", "Terminate")
HotKeySet("{F2}", "ZK")
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
Func ZK()
For $i = 1 To 999
MsgBox(0,0,$i,1)
Next
EndFunc
Func Terminate()
Exit
EndFunc ;==>Terminate #include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 615, 438, 192, 124)
$Btn_start = GUICtrlCreateButton("开始循环", 50, 50, 70, 30)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
HotKeySet("{esc}", "Terminate")
HotKeySet("{F2}", "_ChangeTag")
Global $sTag = False
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Btn_start
GUICtrlSetState($Btn_start, 128)
ZK()
GUICtrlSetState($Btn_start, 64)
EndSwitch
WEnd
Func ZK()
For $i = 1 To 999
If $sTag = True Then
$sTag = False
Return
EndIf
MsgBox(0, 0, $i, 1,$Form1)
Next
EndFunc ;==>ZK
Func _ChangeTag()
$sTag = Not $sTag
EndFunc
Func Terminate()
Exit
EndFunc ;==>Terminate
感谢大神{:face (427):} 我只会在 ZK() 里面加一个 flag
页:
[1]