STDMETHODIMP CEnumFormatEtc::Clone(IEnumFORMATETC **ppCloneEnumFormatEtc) { CEnumFormatEtc *newEnum; if(NULL == ppCloneEnumFormatEtc) return S_FALSE; newEnum = new CEnumFormatEtc(m_pStrFE, m_cItems); if(newEnum ==NULL) return E_OUTOFMEMORY; newEnum->AddRef(); newEnum->m_iCur = m_iCur; *ppCloneEnumFormatEtc = newEnum; return S_OK; }
STDMETHODIMP CEnumFormatEtc::Clone(LPENUMFORMATETC *aResult) { // Must return a new IEnumFORMATETC interface with the same iterative state. if (!aResult) return E_INVALIDARG; CEnumFormatEtc * pEnumObj = new CEnumFormatEtc(mFormatList); if (!pEnumObj) return E_OUTOFMEMORY; pEnumObj->AddRef(); pEnumObj->SetIndex(mCurrentIdx); *aResult = pEnumObj; return S_OK; }