为了增加安德烈亚斯评论,你还可以检查出Delphi.About.com,有一个例子那里下载一个文件,并显示一个进度:http://delphi.about.com/cs/adptips2003/a/bltip0903_2.htm
“如果您需要将指定URL的内容保存到文件中并且能够跟踪下载进度,请使用TDownLoadURL Delphi动作 TDownLoadURL正在写入指定文件时,它会定期生成一个OnDownloadProgress事件,以便您可以向用户提供关于该过程的反馈。 下面是一个示例 - 请注意,您必须在使用条款中包含单元ExtActns。“
uses ExtActns, ...
type
TfrMain = class(TForm)
...
private
procedure URL_OnDownloadProgress
(Sender: TDownLoadURL;
Progress, ProgressMax: Cardinal;
StatusCode: TURLDownloadStatus;
StatusText: String; var Cancel: Boolean) ;
...
implementation
...
procedure TfrMain.URL_OnDownloadProgress;
begin
ProgressBar1.Max:= ProgressMax;
ProgressBar1.Position:= Progress;
end;
function DoDownload;
begin
with TDownloadURL.Create(self) do
try
URL:='http://0.tqn.com/6/g/delphi/b/index.xml';
FileName := 'c:\ADPHealines.xml';
OnDownloadProgress := URL_OnDownloadProgress;
ExecuteTarget(nil) ;
finally
Free;
end;
end;
http://stackoverflow.com/questions/3506251/downloading-a-file-in-delphi,http://stackoverflow.com/questions/4521535/delphi-file-downloader-component,等等 – 2011-05-15 10:32:09