Reputation: 697
we are trying to change and in-proc COM object to an out-of-proc COM object. The new process just passes an Dispatch to previously used COM Object, so we can optionally go back to an in-proc object. This is working fine, but we encounter problems concerning the events. The out-of-process server intercepts the events of the previously used COM object and passes these to an own event interface which is also working. But the problem is that the client cannot connect to this event interface using DispEventAdvise when the out-of-process server is not registered in the windows registry.
The server IDL looks like:
[
object,
uuid(www),
dual,
oleautomation,
nonextensible,
helpstring("IControl Interface"),
pointer_default(unique)
]
interface IControl : IDispatch
{
[id(1)] HRESULT CreateDispatch([out] IDispatch** ppDispatch);
};
[
uuid(xxx),
version(1.0),
helpstring("Control Type Library")
]
library ControlLib
{
importlib("stdole2.tlb");
[
uuid(yyy),
helpstring("IControlEvents Interface"),
nonextensible
]
interface IControlEvents : IUnknown
{
[id(1)] HRESULT MyEvent(void);
};
[
uuid(zzz),
helpstring("_IControlEvents Interface")
]
dispinterface _IControlEvents
{
interface IControlEvents;
};
coclass Control
{
[default] interface IControl;
[default, source] dispinterface _IControlEvents;
};
};
We added the control_i.c, control_p.c and dlldata.c to client and server. And both perform the follwing steps to register the proxy/stub.
PrxDllGetClassObject(IID_IControl, IID_IUnknown, (void **)&punk);
CoRegisterClassObject(IID_IControl, punk, CLSCTX_INPROC_SERVER, REGCLS_SINGLEUSE, &dwRCO);
CoRegisterPSClsid(IID_IControl, IID_IControl);
CoRegisterPSClsid(IID_IControlEvents, IID_IControl);
CoRegisterPSClsid(DIID__IControlEvents, IID_IControl);
This is working for the Control to be created using CoCreateInstance, but not for the events. DispEventAdvise keeps returning CONNECT_E_CANNOTCONNECT cause the QueryInterface for DIID__IControlEvents on the sink returns E_NOINTERFACE.
We really need to get this working without registering the control inside the registry. We also tried to get it registered using manifest files and also separate proxy/stub DLLs but had no success.
Upvotes: 2
Views: 576
Reputation: 697
We ended up registering only the dispatch event interface in the registry, to have the stub class registered correctly. It is now "registered" but without any file references. So we still can have side-by-side installations.
Upvotes: 1