[Lazarus] Windows.PostMessage vs Application.QueueAsyncCall

Michael Schnell mschnell at lumino.de
Mon Mar 17 10:56:42 CET 2014


On 03/16/2014 02:47 AM, Marcos Douglas wrote:
> Like all Windows programmer, I use PostMessage/SendMessage a lot.
> Lazarus team has created Application.QueueAsyncCall method to
> substitute the (old) "Windowish" method todo async calls aka
> PostMessage.
>
> Ok. But what is the best way to use QueueAsyncCall when the caller to
> not knows what type is the receiver?
As QueueAsyncCall does not exist in Delphi you might want to avoid it to 
stay Delphi compatible.

So you can use TThread.Queue that is available both in Delphi (even 
though undocumented in some older versions) and in Lazarus/fpc (even 
though only in the not too old versions).

> QueueAsyncCall need to know the instance and the method to call...
QueueAsyncCall is given the procedure to call and a parameter for same, 
but no "instance". TThread.Queue only gets the (parameter-less) 
procedure to call.

-Michael




More information about the Lazarus mailing list