Hi,
I've poured throught the MSDN documention on remoting; I'm close to
getting things working, but I need to fill in some gaps. Here's what I
need:
1. Remotable Controller class in MySystemTray.exe must be a singleton.
It controls the icon in the system tray and a Windows Form that you can
view by double-clicking the icon in the system tray.
2. Clients must be able to access that instance to show or hide the
Windows Form, or to ask MySystemTray.exe to exit.
3. We have to let the system choose the tcp port; we can't hard-code a
specific port. We can use named ports, though.
Controller class implements IController from a shared DLL and inherits
from MarshalByRef; by itself, it works fine.
So my question is this: What does the .config file on MySystemTray.exe
look like, and what does the .config file (and C# code) on MyClient.exe
look like?
I've tried new, .GetObject, and .CreateInstanceFrom, and none of them
produce the results I'm looking for. Figuring out how to use a system
chosen (albeit named) port has also been difficult--you can't get a URI
from IChannel.
Thanks!
sethlivingston@gmail.com - 25 May 2005 17:19 GMT
>From what I've learned, this can't be done. A singleton in Remoting
just isn't a true singleton if you're talking about two different
processes talking to each other. I ended up using
RegisterWindowMessage() and PostMessage() instead, even though it was
somewhat of a messy solution.