IEnumVARIANT::Clone

ppenum)
IEnumVARIANT FAR* FAR*
ppenum

Creates a copy of the current enumeration state.

Parameter

ppenum

On return, pointer to the location of the clone enumerator.

Return Value

The SCODE obtained from the returned HRESULT is one of the following:

SCODE
Meaning
S_OK
Success.
E_OUTOFMEMORY
Insufficient memory to complete the operation.

Comments

Using this function, you can record a particular point in the enumeration sequence, then return to it at a later time. The enumerator returned 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. Some collections (for example, an enumeration of the files in a directory) will find it impractical to maintain this condition.

Example

The following code implements IEnumVariant::Clone for collections in the Lines sample (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;

}

Software for developers
Delphi Components
.Net Components
Software for Android Developers
More information resources
MegaDetailed.Net
Unix Manual Pages
Delphi Examples
Databases for Amazon shops developers
Amazon Categories Database
Browse Nodes Database