The result for the above code:
" Cannot implicitly convert type 'myATLprojectLib.InterfaceForClassA' to 'myATLprojectLib.InterfaceForClassAClass'. An explicit conversion exists (are you missing a cast?) ", it gives it at the last line.
my idl:
import "oaidl.idl";
import "ocidl.idl";
[
object,
uuid(B825F096-A558-4751-BC3E-13CA91AB08E3),
dual,
nonextensible,
helpstring("IInterfaceForClassA Interface"),
pointer_default(unique)
]
interface IInterfaceForClassA : IDispatch{
[id(1), helpstring("method createClassAObject")] HRESULT createClassAObject(void);
[id(2), helpstring("method setNumberInClassA")] HRESULT setNumberInClassA([in]SHORT pVal);
[id(3), helpstring("method getNumberInClassA")] HRESULT getNumberInClassA([out,retval]SHORT* pVal);
[id(4), helpstring("method getClassA")] HRESULT getClassA([out,retval]VARIANT** pVal);
[id(5), helpstring("method putClassA")] HRESULT putClassA([in]VARIANT* newVal);
};
[
object,
uuid(F6D4B1A3-BA23-4499-92B6-8CC815F45107),
dual,
nonextensible,
helpstring("IInterfaceForClassB Interface"),
pointer_default(unique)
]
interface IInterfaceForClassB : IDispatch{
[id(1), helpstring("method setClassA")] HRESULT setClassA([in]IInterfaceForClassA * val)
[id(2), helpstring("method getClassA")] HRESULT getClassA([out,retval]IInterfaceForClassA ** returnVal)
};
[
uuid(19E570BC-88E1-4EA1-BEBB-55B113C0B71A),
version(1.0),
helpstring("myATLproject 1.0 Type Library")
]
library myATLprojectLib
{
importlib("stdole2.tlb");
[
uuid(5A01A221-647A-4FCC-A2AD-2ADF0DA4895B),
helpstring("InterfaceForClassB Class")
]
coclass InterfaceForClassB
{
[default] interface IInterfaceForClassB;
};
[
uuid(D3ACED71-F62A-43FF-AC69-994222D93308),
helpstring("InterfaceForClassA Class")
]
coclass InterfaceForClassA
{
[default] interface IInterfaceForClassA;
};
);