Re: adding event sink functionality to a COM client not set up as a server
Jason S <jmsachs@gmail.com> wrote:
I have a C++ win32 client (using WTL, which may or may not be beside
the point) that uses a few COM servers I've been designing. Now I am
trying to add event feedback from my COM object back to my client.
(Protocol is a simple pair of source / sink interfaces, no connection
points as I control both ends & don't care about scripting clients
here.)
How the heck do I notify my client from the COM object, since my
client is not a COM object & therefore can't export an interface?
You have the client implement a COM object that exposes the interface,
of course.
1) change my client program so that it is also a COM server. (this
doesn't seem legal, also it seems messy)
Anything implementing a COM object is, technically, a COM server. But
since you don't need to expose COM-creatable objects, you don't need a
full blown server. E.g. you don't need to register anything.
Do you find COM clients that sink regular COM events (connection points
and all that) messy? A connection point is a way for the client to
implement a COM object and pass its pointer to the server, so
technically the client becomes a server itself. This is perfectly
normal.
--
With best wishes,
Igor Tandetnik
With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925