WinHttpRequest.5.1 是 API 对于 Windows 11 还是需要 Iexplorer?

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

我在安装过程中使用此代码加载文件,WinHttpRequest.5.1 是否适合 API Windows 11 还是此 API 对 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;

我认为 WinHttpRequest 不依赖于 Internet Explorer。即使它确实依赖于 IE 的某些内部结构,我相信微软会保留这些内部结构以保持 WinHttpRequest 正常工作。

无论如何,WinHttpRequest 仍然适用于 Windows 11.

来自文档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

...

鉴于上面写着“Windows 2000...及更高版本”,很明显这是一个可以在 Win11 中可靠使用的组件。而且它与IE无关。 (*)


(*) 根据 this page 听起来好像 IE 曾经是旧 5.0 版本的依赖项:“可再分发:WinHTTP 5.0 和 Internet Explorer 5.01 或更高版本Windows XP 和 Windows 2000。"