Delphi XE8 用HttpClient下载文件


本文整理自网络,侵删。

 
uses System.Net.HttpClient;

function DownloadFile(const URL:string; const filename:string):boolean;
var
ms:tmemorystream;
hc:thttpclient;
begin
ms:=tmemorystream.Create;
hc:= thttpclient.Create;
try
try
hc.Get(URL,ms);
ms.SaveTofile(filename);
result:=true;
except
on e: Exception do
ApplicationShowException(e);
end;
finally
hc.Free;
ms.Free;
end;
end;

相关阅读 >>

Delphi edit控制字居中,居左,居右

Delphi 获取其他进程句柄的几种方法

Delphi过滤一段字符里面的html代码的函数

Delphi 建立快捷方式

Delphi with do和for do语句

Delphi tpath

Delphi篇之写托盘图标

Delphi label设置为背景透明

Delphi toolbar按钮添加图标

Delphi 如何获取重载函数的地址

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...