Index   Commented   Search   About

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;

}

Related Links

Software for Delphi and C++ Builder developers
Software for Visual Studio .NET developers
Software for Visual Basic 6 developers
Delphi Tips&Tricks
MegaDetailed.NET
TMS Scripter Studio Pro components for Delphi/C++Builder

More Online Helps

Win32 Programmer's Reference (win32.hlp)
Win32 Multimedia Programmer's Reference (mmedia.hlp)
Microsoft Windows Pen API Programmer's Reference (penapi.hlp)
Microsoft Windows Sockets 2 Reference (sock2.hlp)
Microsoft Windows Telephony API (TAPI) Programmer's Reference (sock2.hlp)
Unix Manual Pages

Free Tech Secrets ;) Copyright © 2008 Free Tect Secrets ;) greatis just4fun network just4fun