Internal COM objects using CComObject possible ?
Hi folks,
I need to instantiate an internal COM object with IDispatch support
(using IDispatchImpl wrappers), but without any registration procedures
(I don't want to write anything in the registry - the object is created
internally and passed to other objects)
The idl file is compiled, and the TLB is merged in the module, but no
registration procedure is ever processed anywhere (and I don't want to).
When calling CMyClass::CreateInstance(&pClass), I always get a COM error
saying that the module wasn't found.. I guess that the Type Library and
other details have to be fetched in some default FinalConstruct (the
constructor is being called, but the classe is destroyed after that),
which fails because no classes were registered.
[ Of course I can't just do a CMyClass *c = new CMyClass() as the class
is abstract and misses all template code ]
What do I need to override so that this can be achieved without (too
much) pain ? Is it possible or am I doomed ?
My class looks like:
class CMyClass :
public CComObjectRoot,
public CComCoClass<CMyClass ,&CLSID_MyClass >,
public IDispatchImpl<CMyClass, &IID_IMyClass, &LIBID_myClassLib>
{
DECLARE_NO_REGISTRY();
DECLARE_PROTECT_FINAL_CONSTRUCT();
...
BEGIN_COM_MAP(CMyClass)
COM_INTERFACE_ENTRY(CMyClass)
COM_INTERFACE_ENTRY2(IDispatch,CMyClass)
...
END_COM_MAP()
...
}
Any hint would be really welcome.