First, the Fmultiparthttp event:
Download Complete Event
Httprequestdone (Sender:tobject; Errorcode:integer; Const reason:string);
Release the downloaded file stream here
FMultiPartHTTP.FileStream.Free;
Fmultiparthttp.filestream: = nil;
Second, download display status information events
Httpshowstats (Sender:tobject);
Display the current download status here
str: = ' downloaded (MB): ' + Format ('%2f ', [fmultiparthttp.totalcount/1024/1024]) +
' percent complete: ' + Format ('%3.0f ', [fmultiparthttp.percentdone]) + '% ' +
' Download speed (kb/seconds): ' + Format ('%6.2f ', [fmultiparthttp.curspeed]) +
' Time consuming: ' + formatdatetime (' Hh:nn:ss ', fmultiparthttp.elapsedtime);
Iii. events related to the ICS progress bar
The following 2 events and progress bar, ICS comes with a download progress bar
Httpprogressaddsegment (Sender:tobject; Startoffset, Aspan, Initpos:int64);
Aspan segment size, initpos segment start size, Startoffset, segment start size
Httpprogresssetposition (Sender:tobject;index:integer; Position:int64);
Index number of segments Position the size of the downloaded fragment
Iv. Examples of usage:
fmultiparthttp.url:= download file address;
fmultiparthttp.partcount:= number of blocks;
Fmultiparthttp.filestream:=tfilestream.create (' download local filename ', fmcreate);
Fmultiparthttp.start;