Поделиться через


DECLARE_NOT_AGGREGATABLE

Specifies that your object cannot be aggregated.

DECLARE_NOT_AGGREGATABLE( 
      x  
)

Параметры

  • x
    [in] The name of the class object you are defining as not aggregatable.

Заметки

DECLARE_NOT_AGGREGATABLE causes CreateInstance to return an error (CLASS_E_NOAGGREGATION) if an attempt is made to aggregate onto your object.

By default, CComCoClass contains the DECLARE_AGGREGATABLE macro, which specifies that your object can be aggregated. To override this default behavior, include DECLARE_NOT_AGGREGATABLE in your class definition.

Пример

class ATL_NO_VTABLE CNoAggClass :
   public CComObjectRoot,
   public CComCoClass<CNoAggClass, &CLSID_NoAggClass>
{
public:
   CNoAggClass()
   {
   }

   DECLARE_NOT_AGGREGATABLE(CNoAggClass)
};

Требования

Header: atlcom.h

См. также

Основные понятия

Aggregation and Class Factory Macros

ATL Macros

DECLARE_ONLY_AGGREGATABLE