How to get TscHttpWebRequest progress?

Discussion of open issues, suggestions and bugs regarding network security and data protection solution - SecureBridge
Post Reply
andydai
Posts: 1
Joined: Tue 07 Sep 2021 04:58

How to get TscHttpWebRequest progress?

Post by andydai » Tue 07 Sep 2021 05:41

download file by URL by TscHttpWebRequest , how to get progress ??

Thanks

YanishevskiyVI
Devart Team
Posts: 25
Joined: Wed 02 Jun 2021 09:30

Re: How to get TscHttpWebRequest progress?

Post by YanishevskiyVI » Tue 07 Sep 2021 12:18

Hi Andy!

Thanks for your question!

To display the progress of download, you need to process TScHttpWebResponse.OnProgress event as follow:

Code: Select all

var 
  ScHttpWebResponse: TScHttpWebResponse;
... 
  ScHttpWebResponse := ScHttpWebRequest.GetResponse(); 
  ScHttpWebResponse.OnProgress := DoOnProgress; 
  //perform reading of response content 
... 
procedure TForm1.DoOnProgress(Sender: TObject; Total, Current: Int64; var Cancel: boolean); 
begin 
//here you can display a progress 
//assign Cancel := True; to stop downloading; 
end; 
Should you have any other questions, feel free to ask!

Regards,
Vitaliy

Post Reply