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

Time:11-18

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 dependensies 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;

CodePudding user response:

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.

CodePudding user response:

From the document https://docs.microsoft.com/en-us/windows/win32/winhttp/winhttp-versions:

WinHTTP Versions

01/07/2021

Users of Microsoft Windows HTTP Services (WinHTTP) should use the latest version of the technology, version 5.1. Version 5.0 is no longer supported.

Version 5.1

WinHTTP 5.1 offers improvements over version 5.0; for more information about new features, see What's New in WinHTTP 5.1.

With version 5.1, WinHTTP is an operating-system component of the following operating systems:

  • Windows 2000, Service Pack 3 and later (except Datacenter Server)
  • Windows XP with Service Pack 1 (SP1) and later Windows Server 2003 with Service Pack 1 (SP1) and later

...

Given that it says "Windows 2000...and later" it seems clear that this is a component you can reliably use in Win11. And it has nothing to do with IE. (*)


(*) It sounds like according to this page at one time IE may have been a dependency: "Redistributable: WinHTTP 5.0 and Internet Explorer 5.01 or later on Windows XP and Windows 2000."

  • Related