On Mon, 29 Aug 2005, Micha Nelissen wrote:
> On Mon, 29 Aug 2005 09:22:31 +0200 (CEST)
> Michael Van Canneyt <[EMAIL PROTECTED]> wrote:
>
> >
> >
> > On Mon, 29 Aug 2005, SteveG wrote:
> >
> > > Could anybody tell me if it is yet possible to send messages between apps
> > > in
> > > Lazarus ?
> > > eg -WM_USER in Windows
> > > If not, any suggestions on how to send a signal to another app (no data)
> > > would
> > > be really appreciated
> >
> > You can always send a message to any application in Windows,
> > so also in Lazarus. The question is what the LCL will do if
> > it encounters a message that it doesn't recognize.
>
> Throw it away :-) Same as with the systray messages. Isn't there a
> cross-platform IPC unit yet in the FCL ? ;-)
>
> At least, that would seem to me a cleaner solution.
I am open for suggestions. The following questions need answers:
1. How will you identify the application ?
2. What with multiple instances of an application ?
3. How to integrate the IPC with the message loop ?
The IPC does not need a message loop, but it must be
implemented in such a way that it can easily be
implemented in the message loop.
What I've thought of so far:
In windows, it's relatively easy:
- Create a window handle with name appname_apphandle.
(can be reduced to simply appname if only one
instance will be running, see the thread about
single instances for my suggestion about that)
- Use this handle to send a message to with WM_COPY.
On linux/Unix:
- Create a unix socket /tmp/appname.appid under /tmp
or under ~/.appname/appid
(same remark about single instance)
- Use this socket to send message to with standard socket
functions.
And generally:
- Implement some CheckMessage() function which can be
used to check for a message.
Wrap all this in a non-visual component which you can
drop on a form, and that is it.
Michael.
_________________________________________________________________
To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
archives at http://www.lazarus.freepascal.org/mailarchives