#include "WinHttp.au3"
$initialurl = "http://google.com"
; Initialize and get session handle
$hOpen = _WinHttpOpen()
; Get connection handle
$hConnect = _WinHttpConnect($hOpen, $initialurl)
; Register Callback function
$hREDIRECT_CALLBACK = DllCallbackRegister("_Redirect", "none", "handle;dword_ptr;dword;ptr;dword")
; Set callback
_WinHttpSetStatusCallback($hConnect, $hREDIRECT_CALLBACK, $WINHTTP_CALLBACK_FLAG_REDIRECT)
; Make a request
$hRequest = _WinHttpSimpleSendRequest($hConnect, Default, "/") ;Here the request follow the redirection and land on a different webpage
MsgBox(1, "Testing", @error)
; Close handles
_WinHttpCloseHandle($hRequest)
_WinHttpCloseHandle($hConnect)
_WinHttpCloseHandle($hOpen)
; Free callback
DllCallbackFree($hREDIRECT_CALLBACK)
; Define callback function
Func _Redirect($hConnect, $iContext, $iInternetStatus, $pStatusInformation, $iStatusInformationLength)
Local $sStatus = "About to automatically redirect the request to: " & DllStructGetData(DllStructCreate("wchar[" & $iStatusInformationLength & "]", $pStatusInformation), 1) & " "
ConsoleWrite("!>" & $sStatus & @CRLF)
MsgBox(4096, "REDIRECTION:", $sStatus)
EndFuncThis is the code I am testing. I can get the msgbox to tell me the @error is 1 but that is the only msgbox that shows up.
test.au3