1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| procedure TfrmPrincipal.btnlmiClick(Sender: TObject);
var
source, dest : string;
function DownloadFile(SourceFile, DestFile: string): Boolean;
begin
try
Result := UrlDownloadToFile(nil, PChar(SourceFile), PChar(DestFile), 0, nil) = 0;
except
Result := False;
end;
end;
begin
source := 'https://mon_site.com/code.aspx?code=' + edTest.Text;
dest := 'c:\temp\app.exe';
if DownloadFile(source, dest) then
ShellExecute(Application.Handle, PChar('open'), PChar(dest), PChar(''), nil, SW_NORMAL)
else
ShowMessage('telechargement erreur')
end; |
Partager