Objects in .EXE Cannot be Aggregated

Last reviewed: May 17, 1995
Article ID: Q114598
The information in this article applies to:
  • Microsoft OLE Libraries for Windows and Win32s, versions 2.0 and 2.01
  • Microsoft OLE Libraries, included with:

        - Microsoft Windows NT, versions 3.5 and 3.51
        - Microsoft Windows 95
    

Attempting to create an aggregate object with a Non-Control object implemented in another .EXE is not possible. Passing a value for the punkOuter parameter of IClassFactory::CreateInstance() in this situation results in the error value CLASS_E_NOAGGREGATION.

The proxy for IClassFactory returns this error value immediately, without calling the CreateInstance() method in the object. According to the rules of aggregation, the Non-Control Object must not reference count the pointer to the controlling IUnknown. If the parts of the aggregate object reside in separate process spaces, the proxy for the controlling IUnknown will be freed prematurely due to the lack of this reference count. Without the interface proxy, the pointer to the controlling IUnknown stored by the Non- Control Object is no longer valid, causing problems when delegating calls to the outer IUnknown.

For more information on the process of Aggregation, please refer to the "OLE 2 Programmer's Reference", "Working with Windows's Objects".


Additional reference words: 2.01 3.50 4.00
KBCategory: kbole kbprg
KBSubcategory: LeTwoOh


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: May 17, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.