On Mon, 29 Aug 2005, Bogusław Brandys wrote:

> Michael Van Canneyt wrote:
> > 
> > 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.
> 
> I assume that under windows full duplex Named Pipes are very similiar to
> Unix  sockets.One process (server) can create Named Pipe (or anonymous
> but it can operate only inside one process memory) and the client can
> write/read (server of course can read/write too!)
> 
> The main problem is that creating named pipes is limited to Windows
> NT/XP. Windows 9X can only work as client of created named pipe.

I know, but named pipes are horribly slow, the windows message
system is much faster, and it works on all Win32 systems.

(I have client/server apps working. We tried named pipes as protocol, 
and we dumped it as soon as we did our first tests)

> Named Pipes are of course under NT/XP  security model like files.
> 
> You can easly find Delphi examples for Named Pipes client /server.
> Named Pipes operate outside message loops.

Yes, but you must be able to integrate it in a message loop.
You can't have your application not responding when you're 
waiting for a message or wanting to send a message; 
The IPC mechanism design must take this into consideration.

Anyway, I'm working on a sample implementation..

Michael.

Reply via email to