[fpc-devel] procedure ... message(); in Linux

Nikolai Zhubr n-a-zhubr at yandex.ru
Thu Feb 18 22:16:31 CET 2010

18.02.2010 16:16, Michael Schnell:
> use "procedure .... message". But In Delphi/Windows you don't need to
> create a server. Just using "procedure .... message" is enough o receive
> a message from another process.
No. AFAIK even in Delphi, "message procedures" for non-components are 
pretty much abstract (and probably almost useless). The messaging system 
you are talking about only works automagically for components belonging 
to the Application component (and is therefore limited to the main thread).

If you create a thread in Delphi (even a Tthread descendant) you will 
not be able to insert components to it, because it is not a component 
itself. So, if you are going to make this messaging work to some degree 
in non-main thread on windows, you'll probably need to take care of some 
things manually. First, you'll need some window handle created within 
your thread, as otherwise OS will not even create a message queue for 
this thread. Delphi won't do this for you, AFAIK. Then, in the body of 
your thread, you'll need to regularily fetch new messages (GetMessage or 
PeekMessage etc) and actually dispatch them to some objects (maybe to 
this very tthread object for instance).

If this is possible with FPC/Linux, I
> should make sure that it's still possible with the NoGUIApplication package.

When I ported some threaded delphi application to linux I replaced 
window handles (used for inter-thread communication) by unix pipes. 
These are not exactly the same, but generally provide sufficient 
functionality and are quite easy to use. No idea if it is anywhere 
appropriate in your case, though.

Hope this helps:)

> -Michael
> _______________________________________________
> fpc-devel maillist  -  fpc-devel at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-devel

More information about the fpc-devel mailing list