Search results for 'ExtActns'. 1 post(s) found.
2007/09/18 08:24
Download a file from the Internet with progress indicator
2007/09/18 08:24 in Delphi

If you need to save the contents of a specified URL to a file - and be able to track the download progress, use the TDownloadURL Delphi action
While TDownloadURL is writing to the specified file, it periodically generates an OnDownloadProgress event, so that you can provide users with feedback about the process.
Here's an example - note that you must include the unit ExtActns in the uses clause.
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://z.about.com/6/g/delphi/b/index.xml';
FileName := 'c:\ADPHealines.xml';
OnDownloadProgress := URL_OnDownloadProgress;
ExecuteTarget(nil) ;
finally
Free;
end;
end;
{
Note:
URL property points to Internet
FileName is the local file
}
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://z.about.com/6/g/delphi/b/index.xml';
FileName := 'c:\ADPHealines.xml';
OnDownloadProgress := URL_OnDownloadProgress;
ExecuteTarget(nil) ;
finally
Free;
end;
end;
{
Note:
URL property points to Internet
FileName is the local file
}
Another posts included in "Delphi"
| Extracting the domain (host) name from an e-mail address (0) | 2007/09/18 |
| How to get get IE favorites (0) | 2007/09/18 |
| How to set the "home page" for the Internet Explorer from Delphi code (0) | 2007/09/18 |
| Are we connected to the Internet? (0) | 2007/09/18 |
| Rotate Bitmap (any angle, any center of rotation) (0) | 2007/09/11 |
| TImage.Bitmap fade out (0) | 2007/09/11 |
| TDesktopCanvas - draw on Windows Desktop (0) | 2007/09/11 |
| TColor to HTML color (0) | 2007/09/11 |
Trackback : Cannot send a trackbact to this post.
-
Subject different money making ideas
2010/01/29 04:06
moneyideas
-
Subject different money making ideas
2010/01/29 12:54
moneyideas
-
Subject different money making ideas
2010/01/31 16:40
moneyideas
Prev

Rss Feed