[prev in list] [next in list] [prev in thread] [next in thread] 

List:       twsocket
Subject:    Re: RES: [twsocket] TFTPClient Question
From:       Wilfried Mestdagh <wilfried () mestdagh ! biz>
Date:       2002-10-30 7:59:37
[Download RAW message or body]

JC,

Too long !
Specially updating screen in windows is a very time consuming thing !
OnProgress is fired every time a chunck of data is arrived, but data can come very fast, so when you 
  are still in OnProgress there can already new messages in message queue, so your program stops 
responding to your own messages (mouse click).

Change the event so that it execute as fast as possible:

procedure TfrmDownload.FTPClientWProgress(Sender: TObject; Count: Integer; var Abort: Boolean);
begin
    Inc(RcvdCount, Count);
    // RcvdCount can be local class variable
end;

Then the calculation code and screen update witch take time you can put it in a OnTimer event of a 
timer that you can fire every (few) seconds.

--
rgds, Wilfried
http://www.mestdagh.biz


On 29.10.02 17:18 JC Clobocar wrote

> I don't think so.
> There follows the code:
> 
> procedure TfrmDownload.FTPClientWProgress(Sender: TObject; Count: Integer;
>   var Abort: Boolean);
> var
>   Human : String;
> begin
>   Bar1.Position := Count;
>   if Count < 1000 then
>     Human := Format('%d bytes', [Count])
>   else
>   if Count < 1000000 then
>     Human := Format('%.1f KB', [Count / 1000])
>   else
>   if Count < 1000000000 then
>     Human := Format('%.1f MB', [Count / 1000000])
>   else
>     Human := Format('%.1f GB', [Count / 1000000000]);
>   Andamento.Caption := Format('%s (%d%%)',
>     [Human, Floor(Count / Bar1.Max * 100)]);
> end;
> 
> -----Mensagem original-----
> De: twsocket-admin@elists.org [mailto:twsocket-admin@elists.org]Em nome
> de Wilfried Mestdagh
> Enviada em: terça-feira, 29 de outubro de 2002 13:53
> Para: twsocket@elists.org
> Assunto: Re: [twsocket] TFTPClient Question
> 
> 
> JC,
> 
> You probably consuming 100 procent CPU time. Do you have lengty code on
> OnProgress (like some update
> on screen ) ?
> 
> --
> rgds, Wilfried
> http://www.mestdagh.biz
> 
> 
> On 29.10.02 16:20 JC Clobocar wrote
> 
> 
>>What should I do to stop a FTP transfer?
>>I create a "Stop Transfer" Button to set a variable to be used in
> 
> OnProgress
> 
>>event but during the transfer (I mean the GetAsync step) that button
> 
> doesn't
> 
>>receive messages (doesn't generate OnClick event).
>>What is the solution?
>>
>>TIA
>>
>>JC Clobocar
>>
>>
>>
>>_______________________________________________
>>To unsubscribe or change your settings for TWSocket mailing list
>>please goto http://www.elists.org/mailman/listinfo/twsocket
>>Visit our website at http://www.overbyte.be
>>
>>
> 
> 
> 
> _______________________________________________
> To unsubscribe or change your settings for TWSocket mailing list
> please goto http://www.elists.org/mailman/listinfo/twsocket
> Visit our website at http://www.overbyte.be
> 
> ---
> Mensagem recebida e livre de virus.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.393 / Virus Database: 223 - Release Date: 30/09/2002
> 
> 
> _______________________________________________
> To unsubscribe or change your settings for TWSocket mailing list
> please goto http://www.elists.org/mailman/listinfo/twsocket
> Visit our website at http://www.overbyte.be
> 
> 



_______________________________________________
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic