OOPortal OOPortal

COM Aggregation   «Prev 

Interface navigation

Interface navigation
Interface navigation

Line 1 Declares an HRESULT to use for COM return values.
Line 2 Declares a pointer to interface IF2.
Line 3 The client creates in instance of OuterCOMObj asking for a pointer to IF2. The client thinks IF2 is implemented in OuterCOMObj,
that is, the aggregated component is not visible to the client. As part of its start-up sequence, OuterCOMObj creates an instance of InnerCOMObj asking for a pointer to IF2 that is returned to the client.
Line 9 Checks to return status of CoCreateInstance.
Line 12 The client calls IF2::QueryInterface asking for a pointer to IF2--an interface in OuterCOMObj. The client is not aware that the IF2::QueryInterface call is made into InnerCOMObj. It thinks it is calling into OuterCOMObj.