Windows Live Writer, Un editor di blog da Microsoft Vista menu con il css
Sep 14

Se si ha bisogno di salvare il cuntenuto di un URL oppure un vero e proprio file presente in rete avendo anche la possibilità di controllare come procede il download, bisogna usare l’action TDownLoadURL. Essa genera un evento OnDownloadProgress, che consente di tenere traccia dei byte scaricati.
Nota: bisogna includere la unit ExtActns nella uses.

uses ExtActns, ...
 
type
TfrMain = class(TForm)
...
private
    procedure URL_OnDownloadProgress
       (Sender: TDownLoadURL;
        Progress, ProgressMax: Cardinal;
        StatusCode: TURLDownloadStatus;
        StatusText: String; var Cancel: Boolean);
...
 
 
implementation
...
 
 
procedure TfrMain.URL_OnDownloadProgress;
  begin
    ProgressBar1.Max:= ProgressMax;
    ProgressBar1.Position:= Progress; 
  end;
 
function DoDownload;
  begin
    with TDownloadURL.Create(self) do
    try
      URL:='http://www.prova.com/index.xml';
      FileName := 'c:\MioFile.xml';
      OnDownloadProgress := URL_OnDownloadProgress;
      ExecuteTarget(nil);
    finally
    Free;
    end;
  end;

(Nessun voto)
Loading ... Loading ...

One Response to “Scaricare file dalla rete con delphi”

  1. ely88 Says:

    Ciao!!!
    nel TdownloadURL.create(self) non mi riconosce self… cosa posso fare??
    e poi doDownload è una funzione?? cosa ritorna?? oppure è una procedura che si avvia xes con il click di un bottone??
    spero che mi risp

Inserisci il tuo Commento:

This is a captcha-picture. It is used to prevent mass-access by robots. (see: www.captcha.net)

You must read and type the 5 chars within 0..9 and A..F, and submit the form.

  

Oh no, I cannot read this. Please, generate a