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 api屏幕传输算法

Delphi 释放bitmap

Delphi 在memorystream查找字符串

Delphi多线程学习:多线程数据库查询(ado)

Delphi图表控件tchart使用faq

Delphi操作文本文件简介

Delphi 格式化输出函数(2): formatdatetime

Delphi删除文件

Delphi实现电脑桌面壁纸更换

Delphi 提升进程令牌

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



打赏

取消

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

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

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

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

评论

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