[fpc-pascal] PostMessage vs. QueueAsyncCall

Mattias Gaertner nc-gaertnma at netcologne.de
Fri Sep 19 11:56:29 CEST 2014


On Fri, 19 Sep 2014 17:20:27 +0800
Xiangrong Fang <xrfang at gmail.com> wrote:

>[...]
> My question is, why cannot Lazarus just use PostMessage, but invent the
> QueueAsyncCall() method?  What is the rationale, or, why PostMessage is
> considered windows-ish (read: not fit into LCL very well?), apart from the
> fact that it is a Windows API?

Please ask Lazarus question on the Lazarus lists.

PostMessage is a WinAPI function that sends an uint, and two pointer
sized integers to a Windows Handle with a queue, even to another
process. See here:
http://msdn.microsoft.com/en-us/library/windows/desktop/ms644944%28v=vs.85%29.aspx

The LCL emulates some parts of PostMessage on other widget sets.

TApplication.QueueAsyncCall on the other side allows to call a method in
the main thread with an optional data pointer. And the call can be
removed from the queue.

Mattias



More information about the fpc-pascal mailing list