$Form1 = GUICreate("Form1", 250, 97, 192, 114)
$Button1 = GUICtrlCreateButton("开始", 24, 24, 201, 41, 0)
GUISetState()
While 1
Switch GUIGetMsg()
Case -3
Exit
Case $Button1
If GUICtrlRead($Button1) = "开始" Then
GUICtrlSetData($Button1, "停止")
_XunHuan()
EndIf
EndSwitch
WEnd
Func _XunHuan()
For $i = 1 to 10
If GUIGetMsg() = $Button1 And GUICtrlRead($Button1) = "停止" Then
GUICtrlSetData($Button1, "开始")
Return
Else
MsgBox(0, 0, $i)
EndIf
Next
EndFunc
|