[Lazarus] controling a loop

Paul Breneman list2010 at BrenemanLabs.com
Thu Aug 11 15:09:14 CEST 2016

On 08/11/2016 07:58 AM, JuuS wrote:
> Hi,
>> Besides the typo ;-) Application.ProcessMessages did the trick. Thanks.
> Don't know if this is an issue anymore, it was in Delphi some time ago
> so you may want to check:
> It used to be Application.processmessages pegged cpu to 100%. The
> alternative "application.handlemessage" may be a bit slower but much
> nicer on the cpu. Again, don't know if this is an issue in Lazarus.

A loop with Application.ProcessMessages with 100% CPU usage will also 
use up your battery on a laptop or mobile device.  An easy way to 
improve that is to put sleep(10) into the loop.

Here a short explanation of the alternative I use most of the time:

You can find the above link and other things here:


More information about the Lazarus mailing list