Hello, how should I stop any code running inside a loop? using the best method.
Thanks.
#include "WinHttp.au3"
#include <WindowsConstants.au3>
Global $sDomain = "https://website.com"
Global $sPage = "page.html"
$Form1 = GUICreate("TEST", 328, 178, 192, 124)
$Start = GUICtrlCreateButton("Start", 24, 144, 75, 25)
$Stop = GUICtrlCreateButton("Stop", 224, 144, 75, 25)
$Console = GUICtrlCreateEdit("", 8, 8, 313, 129)
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Start
$hOpen = _WinHttpOpen()
$hConnect = _WinHttpConnect($hOpen, $sDomain)
For $i = 1 To 20
$sReturned = _WinHttpSimpleSSLRequest($hConnect, "POST", $sPage, Default)
; Reporting to console
GUICtrlSetData($Console, GUICtrlRead($Console & @CRLF))
Next
Case $Stop
; Stop the posting process up there ^
EndSwitch
WEnd
_WinHttpCloseHandle($hConnect)
_WinHttpCloseHandle($hOpen)