windows - WinHttpRequest.5.1 是适用于 Windows 11 的良好 API 还是需要 Iexplorer?

标签 windows inno-setup ole pascalscript winhttprequest

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

最佳答案

摘自文档https://learn.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 版本的依赖项:“可再发行:Windows XP 和 Windows 2000 上的 WinHTTP 5.0 和 Internet Explorer 5.01 或更高版本。

关于windows - WinHttpRequest.5.1 是适用于 Windows 11 的良好 API 还是需要 Iexplorer?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70016852/

相关文章:

windows - Win32/DLL : The address that is jumped to when a DLL function is called?

inno-setup - Inno安装程序文件复制失败

c++ - 使用 OLE 剪贴板和经典剪贴板时出现意外/奇怪的结果,还是我错过了什么?

Delphi 6 OleContainer SaveAsDocument 在 Windows 7/Word 2010 中创建损坏的文件,在 XP/Word 2003 中正常

delphi - 再次使用 delphi 进行 openoffice calc

java - 无法通过Java代码执行java -jar命令

c# - 如何响应 ContextMenuStrip 项单击

inno-setup - 循环遍历字符串数组 - 类型不匹配

inno-setup - 在 Inno Setup 中,如何使窗口中的某些文本居中?

c - 如何在C中找到函数的返回地址?