Download a File from internet programatically with an Progress event using Delphi and Indy -
I need to download a file from the Internet using Delphi from HTTP, which contains a progress event, I I'm seeing
I'm using Delphi 7.
Thanks in advance.
I have coded this example, with Indy 10, using just one HTTP GET, Hope it works also with Indy 9:
Usage {. ..} IDHTP, IDCMPent; Type TFormMain = Class (TForm) {...} Private {...} Process HttpWork (Asunder: TubEygect; AuckRoad: TWorkMode; AWorkCount: Int64); End; {...} Process TFormMain.Button1Click (Sender: TObject); War HTTP: TIDHTP; MS: Tmoristream; Start HTTP: = TIDHTP Composition (zero); Try MS: = TMemoryStream.Create; Try Http.Onwork: = HttpWork; Hptgate ('http://live.sysinternals.com/ADExplorer.exe', MS); MS.SaveToFile ('C: \ ADExplorer.exe'); Finally MS free; End; Finally, free; End; End; Process TFormMain.HttpWork (Acedor: Toubacht; AWorkMode: TWorkMode; AWorkCount: Int64); War HTTP: TIDHTP; ContentLength: Int64; Percent: Integer; Start HTTP: = TIDHTP (Accord); ContentLength: = Http.Response.ContentLength; If (Pause ('Chunked', lowercase (HTTP response. Transfer encoding)) = 0) and (content length> gtc: 0) then starts Percentage: = 100 * Everkkunt Divine Content Length; MemoOutput.Lines.Add (IntToStr (percent)); End; End;
Comments
Post a Comment