Internet - fazendo download de um arquivo sem uso de componentes |
Top Previous Next |
|
uses URLMon, ShellApi;
function DownloadFile(aURL, aLocal: string): Boolean; begin try Result := UrlDownloadToFile(nil, PChar(aURL), PChar(aLocal), 0, nil) = 0; except Result := False; end; end;
if DownloadFile(SourceFile, DestFile) then begin ShowMessage('Download succesful!'); // Show downloaded image in your browser ShellExecute(Application.Handle, PChar('open'), PChar(DestFile), PChar(''), nil, SW_NORMAL) end else ShowMessage('Error while downloading ' + SourceFile)
|