共用方式為


CComEnumImpl::Clone

This method provides the implementation of the IEnumXXXX::Clone method by creating an object of type CComEnum, initializing it with the same array and iterator used by the current object, and returning the interface on the newly created object.

STDMETHOD(Clone)( 
   Base** ppEnum  
);

Parameters

  • ppEnum
    [out] The enumerator interface on a newly created object cloned from the current enumerator.

Return Value

A standard HRESULT value.

Remarks

Note that cloned enumerators never make their own copy (or take ownership) of the data used by the original enumerator. If necessary, cloned enumerators will keep the original enumerator alive (using a COM reference) to ensure that the data is available for as long as they need it.

Requirements

Header: atlcom.h

See Also

Reference

CComEnumImpl Class

CComEnumImpl::Init