Microsoft KB Archive/114598

= Objects in .EXE Cannot be Aggregated =

Article ID: 114598

Article Last Modified on 3/3/2005

-

APPLIES TO

 Microsoft OLE 2.0 Microsoft OLE 2.01 Microsoft OLE 4.0, when used with:  Microsoft Windows NT 4.0

 Microsoft Windows NT 3.51 Service Pack 5

 Microsoft Windows 95</li></ul> </li></ul>

-

<div class="notice_section">

This article was previously published under Q114598

<div class="notice_section">

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 query words: 2.01 3.50 4.00

Keywords: kbprogramming KB114598

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.