Search code examples
windowsinno-setupolepascalscriptwinhttprequest

Is WinHttpRequest.5.1 a good API for Windows 11 or does it require Iexplorer?


I am using this code to load files during setup, is WinHttpRequest.5.1 a good API for Windows 11 or does this API have some dependencies to Internet Explorer?

function DownloadFile(const AURL: string; var AResponse: string): Boolean;
var
  WinHttpRequest: Variant;
begin
  Result := True;
  try
    WinHttpRequest := CreateOleObject('WinHttp.WinHttpRequest.5.1');
    WinHttpRequest.Open('GET', AURL, False);
    WinHttpRequest.Send;
    AResponse := WinHttpRequest.ResponseText;
  except
    Result := False;
    AResponse := GetExceptionMessage;
  end;
end;

Solution

  • I do not think that WinHttpRequest has dependency on Internet Explorer. And even if it did depend on some internals of IE, I'm sure Microsoft would keep those internals to keep the WinHttpRequest working.

    In any case, WinHttpRequest still works on Windows 11.