Partager via


CComAggObject::CreateInstance

This static function allows you to create a new **CComAggObject<**contained > object without the overhead of CoCreateInstance.

static HRESULT WINAPI CreateInstance( 
   LPUNKNOWN pUnkOuter, 
   CComAggObject< contained >** pp  
);

Parameters

  • pp
    [out] A pointer to a **CComAggObject<**contained > pointer. If CreateInstance is unsuccessful, pp is set to NULL.

Return Value

A standard HRESULT value.

Remarks

The object returned has a reference count of zero, so call AddRef immediately, then use Release to free the reference on the object pointer when you're done.

If you do not need direct access to the object, but still want to create a new object without the overhead of CoCreateInstance, use CComCoClass::CreateInstance instead.

Requirements

Header: atlcom.h

See Also

Reference

CComAggObject Class