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链接自己的主页和邮件

Delphi 利用hook技术实现键盘监控

Delphi 实现最简单的注册机

Delphi 运行js

Delphi 网址链接结尾自动补/

Delphi通过窗口标题结束指定进程函数

Delphi deletedirectory 删除目录下所有文件包括子文件夹下所有文件

Delphi写console控制台程序

Delphi 反外挂,反破解思想代码

Delphi编程时按回车键无效,无法换行解决办法

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



打赏

取消

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

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

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

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

评论

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