[Lazarus] Windows.PostMessage vs Application.QueueAsyncCall
Michael Schnell
mschnell at lumino.de
Mon Mar 17 16:20:11 CET 2014
On 03/17/2014 04:09 PM, Michael Schnell wrote:
>
>
> If you meant the self pointer of AMethod, I of course am with you (as
> same is a "procedure of object").
>
But that is rather trivial, and AMethod could be a procedure of any
class (inducing but not forcing the "TThread" instance that schedules
the call.
> I think that I need is too much for a simple call to QueueAsyncCall.
> I'm doing tests with FP Observer implementation too.
A nice trick is to create an instance of a "data holding" object, fill
it and provide it as "Data" with QueueAsyncCall. In the call you can
free the "data holding" object.
Another trick that also works with TThread.Queue is to provide the data
holding" class with a procedure, create and fill same and provide the
procedure (including instance) with TThread.Queue. Here you need to take
more care with freeing the object. I'm not sure if you simply can do
"free;" as the last instruction before returning from the procedure.
-Michael
More information about the Lazarus
mailing list