Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Specifies that your object must be aggregated.
Syntax
DECLARE_ONLY_AGGREGATABLE(
x
)
Parameters
- x
[in] The name of the class object you are defining as only aggregatable.
Remarks
DECLARE_ONLY_AGGREGATABLE causes an error (E_FAIL) if an attempt is made to CoCreate your object as nonaggregated object.
By default, CComCoClass contains the DECLARE_AGGREGATABLE macro, which specifies that your object can be aggregated. To override this default behavior, include DECLARE_ONLY_AGGREGATABLE in your class definition.
Example
class ATL_NO_VTABLE COnlyAggClass :
public CComObjectRoot,
public CComCoClass<COnlyAggClass, &CLSID_OnlyAggClass>
{
public:
COnlyAggClass()
{
}
DECLARE_ONLY_AGGREGATABLE(COnlyAggClass)
};
Requirements
Header: atlcom.h
See Also
Aggregation and Class Factory Macros
ATL Macros
DECLARE_NOT_AGGREGATABLE