CComCollection storage
Hello all,
i'm using a CComCollection (from http://www.codeguru.com/cpp/com-tech/activex/com/article.php/c2637/
)
with an own interface.
CComPtr<IMyObjects> objs;
hr = objs.CoCreateInstance(CLSID_MYObjects);
and if i pass it to a function of a COMServer, everything works fine.
But when i want another interface to store it
i.e.
IContainer *cnt = NULL;
hr = CoCreateInstance(CLSID_Container, NULL, CLSCTX_INPROC_SERVER,
IID_IContainer,(void**)&cnt);
....
cnt->put_Objects(objs)
IMyObjects *test = NULL;
cnt->get_Objects(test);
then test = NULL!
Nothing done, just set the pointer!
Probably a very simple error, but i can't see it :-(
Thanks in advance,
Stefan
Defined in the header:
IMyObjects *Objects;
Here the two Methods of my Container object
HRESULT STDMETHODCALLTYPE CContainer ::get_Objects(IMyObjects *pVal)
{
pVal = Objects;
return S_OK;
}
HRESULT STDMETHODCALLTYPE CContainer ::put_Objects(IMyObjects *newVal)
{
Objects = newVal;
return S_OK;
}