Re: Cannot create the object
On 27 Apr, 17:41, "Igor Tandetnik" <itandet...@mvps.org> wrote:
You promise in the IDL that your coclass implements some interface, but
don't actually list it in your interface map. VB queries for this
interface, and fails.
Hi Igor, thanks for the reply..
Mmm...ok, let's me understand.
My IDL contains:
[
object,
uuid(BF5573D1-28DD-11DE-ABF5-005056C00008),
//dual,
oleautomation,
nonextensible,
helpstring("IATDevice Interface"),
pointer_default(unique)
]
interface IATDevice : IUnknown
{...}
[
object,
uuid(BF5573CE-28DD-11DE-ABF5-005056C00008),
//dual,
oleautomation,
nonextensible,
helpstring("ITetra Interface"),
pointer_default(unique)
]
interface ITetra : IUnknown
{...}
[
uuid(BF5573D3-28DD-11DE-ABF5-005056C00008),
dual,
nonextensible,
helpstring("Dual interface for TETRA objects"),
hidden
]
interface ITetraDisp : IDispatch
{..}
[
uuid(BF5573CD-28DD-11DE-ABF5-005056C00008),
version(1.0),
helpstring("AT ActiveX Type Library")
]
library AxEuroATLib
{
importlib("stdole2.tlb");
[
uuid(BF5573CF-28DD-11DE-ABF5-005056C00008),
helpstring("_ITETRAMotoEvents Interface")
]
dispinterface _ITETRAMotoEvents
{...}
[
uuid(BF5573D0-28DD-11DE-ABF5-005056C00008),
helpstring("TETRAMoto Class")
]
coclass TETRAMoto
{
[default] interface ITetraDisp;
[default, source] dispinterface _ITETRAMotoEvents;
}
}
My class is defined as:
class ATL_NO_VTABLE CTETRAMoto :
public CComObjectRootEx<CComSingleThreadModel>,
public CComCoClass<CTETRAMoto, &CLSID_TETRAMoto>,
public ISupportErrorInfo,
public IConnectionPointContainerImpl<CTETRAMoto>,
public CProxy_ITETRAMotoEvents<CTETRAMoto>,
//public IDispatchImpl<ITetra, &IID_ITETRAMoto, &LIBID_AxEuroATLib, /
*wMajor =*/ 1, /*wMinor =*/ 0>,
public IATDevice, //Added by me
public ITetra, //Added by me
public IDispatchImpl<ITetraDisp, &__uuidof(ITetraDisp),
&LIBID_AxEuroATLib, /* wMajor = */ 1, /* wMinor = */ 0>
{
public:
CTETRAMoto();
DECLARE_REGISTRY_RESOURCEID(IDR_TETRAMOTO)
BEGIN_COM_MAP(CTETRAMoto)
COM_INTERFACE_ENTRY(IATDevice) //Added by me
COM_INTERFACE_ENTRY(ITetra)
COM_INTERFACE_ENTRY(IDispatch) //Added by me
//COM_INTERFACE_ENTRY2(IDispatch, ITetraDisp)
COM_INTERFACE_ENTRY(ISupportErrorInfo)
COM_INTERFACE_ENTRY(IConnectionPointContainer)
//COM_INTERFACE_ENTRY(ITetraDisp)
END_COM_MAP()
BEGIN_CONNECTION_POINT_MAP(CTETRAMoto)
CONNECTION_POINT_ENTRY(__uuidof(_ITETRAMotoEvents))
END_CONNECTION_POINT_MAP()
// ISupportsErrorInfo
STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
....
}
So the mistake is in the COM_MAP?
Thanks for the patient!!
Daniele.