(Delphi), such as and downloading an example of a network file

xiaoxiao2021-03-06  84

FTP download: http://www.7880.com/info/Article-19938Be0.html http://community.9cbs.net/expert/topic/3300/3300012.xml?temp=5.028933E-02FTP Download: TIDFTP control (Delphi7 IND) HTTP Download: (Delphi7) Download Network Files Using Design INDY Controls // Add controls in Form1: Two Indy controls: idantifreeze1, idHTTP1; a button: Button1; a progress bar: Progressbar1 Show download speed

procedure TForm1.Button1Click (Sender: TObject); var MyStream: TMemoryStream; begin IdAntiFreeze1.OnlyWhenIdle: = False; // make the program is provided with a reaction MyStream:. = TMemoryStream.Create; try IdHTTP1.Get ( 'http: // www. appcontrols.com/demos/exe/HTTPDemo.exe',MyStream); except Showmessage ( 'no download success!'); MyStream.Free; Exit; end; MyStream.SaveToFile (ExtractFilePath (paramstr (0)) 'HTTPDemo. Zip '); MyStream.free; showMessage (' ok ');

procedure TForm1.IdHTTP1WorkBegin (Sender: TObject; AWorkMode: TWorkMode; const AWorkCountMax: Integer);. begin // start the download before, the maximum size of the data set ProgressBar1 needs to receive ProgressBar1.Max: = AWorkCountMax; ProgressBar1.Min: = 0; progressbar1.position: = 0;

procedure TForm1.IdHTTP1Work (Sender: TObject; AWorkMode: TWorkMode; const AWorkCount: Integer); begin // when receiving data, will be displayed in the progress ProgressBar1 ProgressBar1.Position: = ProgressBar1.Position AWorkCount; end;.

转载请注明原文地址:https://www.9cbs.com/read-106102.html

New Post(0)