#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

; Global $i = 0

#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 ###


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            line()
            AdlibRegister(line, 1000)

        Case $Button2          
             AdlibUnRegister(line)

    EndSwitch
WEnd

Func line()
       Local Static $i = 0
       GUICtrlSetData($Edit1,"line : "&$i&@CRLF,1)
       $i += 1
EndFunc