[Lazarus] Sending messages

zeljko zeljko at holobit.net
Sat Nov 26 08:25:24 CET 2011

On Saturday 26 of November 2011 07:45:36 Felipe Monteiro de Carvalho wrote:
> On Fri, Nov 25, 2011 at 2:33 PM, Hans-Peter Diettrich
> <DrDiettrich1 at aol.com> wrote:
> >>> This doesn't answer my question. What's the *source* of the processed
> >>> messages?
> > 
> > And how does PostMessage fit into the picture?
> If this is for writing documentation, then you are clearly on the
> wrong track here. Libraries work with the black box concept. The user
> does not need to know where the messages from PostMessage are stored,
> they are stored "somewhere" and will reappear "sometime later" in the
> main thread. That's enough.
> Any information of "where" the messages were in between is an
> implementation detail which can change at any time. It also changes
> from widgetset to widgetset.

Maybe he want to explain how and where PostMessage can be used in 
multithreading environment, IMO this is important part since PostMessage is 
thread safe and gives you ability to do calculating stuff in threads and flood 
main thread with messages needed by your app. As I already mentioned, I'm 
already using such stuff in production app (OnAirDeeJay - radio station double 
player + mixer + libfmod4). Each player have it's own threads for loading data 
(ogg,mp3,wav), another is playing and 3rd is used for mixing (fade-in, fade-
out). Complete stuff is synchronized to main thread via PostMessage and works 
perectly. Note that eg. player thread sends PostMessage each ms for each tick 
of TTrackbar, also user can click track bar and seek , also main thread have 
it's own threads for players to calculate spectrum data ,again PostMessage is 
response for this part too .... etc etc.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20111126/3caaff57/attachment-0003.html>

More information about the Lazarus mailing list