I have created a simple object using the ATL. Within this object I have two contained or "delegated" objects, Obj1 and Obj2.
These "inner" objects need to communicate with one another. Now here is the problem, within a method of Obj1 I perform the following;
CComQIPtr<IObj2, &IID_IObj2> pobj2 (GetControllingUnknown());
The above code fails because GetControllingUnknown() returns Obj1's OWN IUnknown pointer.
So I tried the following
CComQIPtr<IObj2, &IID_IObj2> pobj2 (m_pOuterUnknown);
This code asserts because m_pOuterUnknown is actually the reference count of Obj1 (if it's not an aggregate thats what it contains)
Is it not possible to query for another interface in contained objects? I cannot determine how to get the "outer" objects IUnknown.