You are not logged in.
mORMot2, unit mormot.net.client
Could you make the following changes in class TWinHttpApi in the function InternalRetrieveAnswer():
At the first call of OnProgress pmCurrentSize should be 0 (pmCurrentSize = 0).
At the last call of OnProgress pmCurrentSize should be pmContentLength (pmCurrentSize = pmContentLength).
I want to display a form with a progress bar with the following assignment:
TWinHttpApi(FRestHttpClient.Request).OnProgress := TWinHttpProgress.DoShowAndProgress;
If the content length is not known, the marquee mode should be activated for the ProgressBar. The current implementation does not allow this.
My ideal implementation looks like this:
TWinHttpProgress = class(TObject)
strict private
class var
FWindowList: Pointer;
FProgressForm: TForm;
protected
class procedure ShowForm(pmIsMarqueeMode: Boolean);
class procedure HideForm;
class procedure Progress(pmCurrentSize, pmContentLength: Cardinal);
public
class procedure DoShowAndProgress(pmSender: TWinHttpApi; pmCurrentSize, pmContentLength: Cardinal);
end;
class procedure TWinHttpProgress.DoShowAndProgress(pmSender: TWinHttpApi; pmCurrentSize, pmContentLength: Cardinal);
begin
if pmCurrentSize = 0 then
TWinHttpProgress.ShowForm(pmContentLength = 0)
else if pmCurrentSize = pmContentLength then
TWinHttpProgress.HideForm
else
TWinHttpProgress.Progress(pmCurrentSize, pmContentLength);
end;
Many thanks in advance.
With best regards
Thomas
Offline