#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Global $i = 0
Global $kBoolean = True
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 272, 234, 192, 124)
$Edit1 = GUICtrlCreateEdit("", 16, 16, 225, 161)
GUICtrlSetData(-1, "Edit1")
$Button1 = GUICtrlCreateButton("start", 40, 184, 75, 25)
$Button2 = GUICtrlCreateButton("stop", 168, 184, 75, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
Func line()
While $kBoolean
GUICtrlSetData($Edit1,"line : "&$i&@CRLF,1)
Sleep(1000)
$i += 1
WEnd
EndFunc
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
line()
Case $Button2
$kBoolean = False
EndSwitch
WEnd
I have two button ( "start" and "stop") .
When I click start it will print "line :" $i += 1 .
but when I want to stop and resume after stopped.
What should I write to do "that" function I want.
sorry for my bad english.
Thanks for reading