Kód: Vybrat vše
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ComCtrls, ExtCtrls, ExtActns;
type
TfrMain = class(TForm)
Label1: TLabel;
Label2: TLabel;
ProgressBar1: TProgressBar;
Button1: TButton;
procedure Button1Click(Sender: TObject);
procedure DoDownload(vURL, vArquivo : String);
private
procedure URL_OnDownloadProgress
(Sender: TDownLoadURL;
Progress, ProgressMax: Cardinal;
StatusCode: TURLDownloadStatus;
StatusText: String; var Cancel: Boolean) ;
{ Private declarations }
public
{ Public declarations }
end;
var
frMain: TfrMain;
implementation
{$R *.dfm}
procedure TfrMain.Button1Click(Sender: TObject);
begin
DoDownload('http://losa.no-ip.info/XXX.exe','C:\Program Files\WifiLINK\Update\WifiLINK.exe')
end;
procedure TfrMain.DoDownload;
begin
with TDownloadURL.Create(self) do
try
URL:= vURL;
FileName := vArquivo;
OnDownloadProgress := URL_OnDownloadProgress;
ExecuteTarget(nil) ;
finally
Free;
end;
end;
procedure TfrMain.URL_OnDownloadProgress;
begin
ProgressBar1.Max:= ProgressMax;
ProgressBar1.Position:= Progress;
end;
end.

