Not able to get memory of Hierarchy in QT-COM
-
We have Base and 2 derived class, If we try to get the derived class memory in COM using Queryinterface we face a Error: "E_NOINTERFACE No such interface supported".
Code snippet :
Main.cpp
QAXFACTORY_BEGIN((SWIQAX_FACTORY_BEGIN, SWIQAX_FACTORY_END)
QAXCLASS(Base)
QAXTYPE(D1)
QAXTYPE(D2)
QAXFACTORY_END()Class Base {}
Class D1 : Base {}
Class D2 : D1 {}
In Client :
CComPtr<Base> B1;
CComPtr<D2> D1;
CComPtr<D2> D2;
HRESULT hr = B1->CoCreate(uuid(Base));HRESULT hr1 = B1.QueryInterface(&D2); -> Here We are able to get memory of D2
HRESULT hr2 = B1.QueryInterface(&D1); -> Here we are not able to get the memory for D1 (NULL)
HRESULT hr3 = D2.QueryInterface(&D1); -> Here also we are not able to get the memory for D1 (NULL)Is there any way we can get memory of D1 ? or any macro like QAXFACTORY_BEGIN will help us to get D1 memory
-
In the client's code, try change from:
... CComPtr<D2> D1; CComPtr<D2> D2; ...to
... CComPtr<D1> D1; CComPtr<D2> D2; ...Yes we have made syntax error on code which we have posted as you said we have tried on it but still we are facing same issue not able to get D1.