Share via


IEnumVARIANT::Clone (Windows CE 5.0)

Send Feedback

This method creates a copy of the current state of enumeration.

HRESULT Clone( IEnumVARIANT FAR* FAR* ppEnum );

Parameters

  • ppEnum
    [out] On return, pointer to the location of the clone enumerator.

Return Values

If the method succeeds, the return value is S_OK.

If there is insufficient memory to complete the operation, the return value is E_OUTOFMEMORY.

Remarks

Using this function, a particular point in the enumeration sequence can be recorded, and then returned to at a later time. The returned enumerator is of the same actual interface as the one that is being cloned.

There is no guarantee that exactly the same set of variants will be enumerated the second time as was enumerated the first. Although an exact duplicate is desirable, the outcome depends on the collection being enumerated.

You may find that it is impractical for some collections to maintain this condition (for example, an enumeration of the files in a directory).

Example

The following code implements Clone for collections in the Lines sample file Enumvar.cpp.

STDMETHODIMP
CEnumVariant::Clone(IEnumVARIANT FAR* FAR* ppEnum)
{
CEnumVariant FAR* penum = NULL;
HRESULT hr;

*ppenum = NULL;

hr = CEnumVariant::Create(m_psa, m_cElements, &penum);
if (FAILED(hr))
goto error;
penum->AddRef();
penum->m_lCurrent = m_lCurrent;

*ppenum = penum;
  return NOERROR;

error:
if (penum)
penum->Release();
return hr;
}

Requirements

OS Versions: Windows CE 2.0 and later.
Header: Oaidl.h, Oaidl.idl.
Link Library: Oleaut32.lib, Uuid.lib.

See Also

IEnumVARIANT

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.