unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs ,URLMon, StdCtrls ,WinInet, ShellApi, ExtCtrls ;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Déclarations privées }
public
{ Déclarations publiques }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
Function DownloadFile(Source, Dest: string): Boolean;
begin
try
Result := UrlDownloadToFile(nil, PChar(Source), PChar(Dest), 0, nil) = 0;
except
Result := False;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
const
SourceFile='http://www.delphi4arab.net/logo.gif';
DestFile ='logo.gif';
begin
if DownloadFile (SourceFile,DestFile) Then
Showmessage ('ok')
else
Showmessage ('no');
end;
end.