COM event firing to multiple targets
-
Creating a COM dll -module that fires events is simple enough (ATL -project -> add ATL simple object with Connection point -support -> Add a couple methods etc.), but: What flags are needed for multiple instances to catch the same event when it is fired? I.e. when I CoCreateInstanceEx a connection to module from let's say 2 separate exe's, both can receive the same event. Tried quite a few combinations so far and yet no success.
-
Creating a COM dll -module that fires events is simple enough (ATL -project -> add ATL simple object with Connection point -support -> Add a couple methods etc.), but: What flags are needed for multiple instances to catch the same event when it is fired? I.e. when I CoCreateInstanceEx a connection to module from let's say 2 separate exe's, both can receive the same event. Tried quite a few combinations so far and yet no success.
You need another Class Factory. Use the DECLARE_CLASSFACTORY_SINGLETON macro. In this case all COM-clients get the same instance. In this case your COM-Object must be threadsafe ! Greetings
-
You need another Class Factory. Use the DECLARE_CLASSFACTORY_SINGLETON macro. In this case all COM-clients get the same instance. In this case your COM-Object must be threadsafe ! Greetings
Even with singleton COM objects if it is an in-process component then you'd still get separate notifications from multiple EXE clients. You would either have to make the component out-process or
CoCreateInstance
it from one EXE and load it up into the Running Object Table (ROT) usingRegisterActiveObject
and grab a reference to it from the second EXE usingGetActiveObject
.-- gleat http://blogorama.nerdworks.in[^] --
-
You need another Class Factory. Use the DECLARE_CLASSFACTORY_SINGLETON macro. In this case all COM-clients get the same instance. In this case your COM-Object must be threadsafe ! Greetings