Uses ComObj;// indispensable
Function DoFileDownloadEx(lpszFile: LPCWSTR; Save: Bool):Cardinal; Stdcall; External 'shdocvw.dll' name 'DoFileDownloadEx';
Implementation
Procedure DownloadThisFileAnd(Const aUrl: String; Const Save: Boolean = True);
Var
pwcUrl: PWideChar;
Begin
GetMem(pwcUrl, 2048);
StringToWideChar(aUrl, pwcUrl, 2048);
DoFileDownloadEx(pwcUrl, Save);
FreeMem(pwcUrl);
End;
//Utilisation
Procedure TForm1.Button1Click(Sender: TObject);
Var
sUrl: String;
Begin
sUrl := 'http://www.delphifr.com/g/v9logo/logodel.gif';
DownloadThisFileAnd(sUrl);// propose de l'enregistrer
//DownloadThisFileAnd(sUrl, False);// le télécharge et l'ouvre
End;