uses urlmon;
function DownloadFile(Source, Dest: string): Boolean; //下载文件的函数
begin
try
Result := UrlDownloadToFile(nil, PChar(source), PChar(Dest), 0, nil) = 0;
except
Result := False;
end;
end;
本文介绍了一个使用UrlMon组件下载文件到本地的简单函数。该函数通过UrlDownloadToFile API实现文件下载功能,并处理了基本的异常情况。
uses urlmon;
function DownloadFile(Source, Dest: string): Boolean; //下载文件的函数
begin
try
Result := UrlDownloadToFile(nil, PChar(source), PChar(Dest), 0, nil) = 0;
except
Result := False;
end;
end;

被折叠的 条评论
为什么被折叠?