Newsgroups : Borland : borland.public.delphi.nativeapi.win32 : 2005 Apr : Of DLLs and Named Pipes
| Subject: | Of DLLs and Named Pipes |
| Posted by: | "AndrewH" (hilliar.andr..@abc.net.au) |
| Date: | 6 Apr 2005 23:16:23 |
Hi, folks.
I had a requirement to act as a 'middleware plugin' for one app to talk to another. The app I have to talk to is a named pipe server, so I constructed a named pipe client in my plugin dll. Being a delphi guy, I found a v.nice named pipes implementation and tested it by creating a server and a client app. Fine, works great. So I implement in my DLL, by duynamic creation of the component (there's no form). The DLL initialises the client pipe and connects to the server when the DLL loads. This works. Data sent over the new pipe never gets there. Digging around in the pipes implementation, I found it makes extensive use of events and messages. It would appear that this is the problem: The pipe client gets created with an owner=nil, so there is no message loop so nothing works. If I bypass the event structure and force the component to send the data, it works. But then there are no notifications if the server closes the pipe etc.
SO MY QUESTION IS!! Is there an elegant way for a dll to process messages/events? The parent (plugin) app does not provide an hwnd to use, I don't think that would work anyway-
Any ideas appreciated!