IStorage::EnumElements method (objidl.h)

The EnumElements method retrieves a pointer to an enumerator object that can be used to enumerate the storage and stream objects contained within this storage object.


HRESULT EnumElements(
  [in]  DWORD        reserved1,
  [in]  void         *reserved2,
  [in]  DWORD        reserved3,
  [out] IEnumSTATSTG **ppenum


[in] reserved1

Reserved for future use; must be zero.

[in] reserved2

Reserved for future use; must be NULL.

[in] reserved3

Reserved for future use; must be zero.

[out] ppenum

Pointer to IEnumSTATSTG* pointer variable that receives the interface pointer to the new enumerator object.

Return value

This method can return one of these values.

Return code Description
S_OK The enumerator object was successfully returned.
E_PENDING Asynchronous Storage only: Part or all of the element's data is currently unavailable.
STG_E_INSUFFICIENTMEMORY The enumerator object could not be created due to lack of memory.
STG_E_INVALIDPARAMETER One of the parameters was not valid.
STG_E_REVERTED The storage object has been invalidated by a revert operation above it in the transaction tree.


The enumerator object returned by this method implements the IEnumSTATSTG interface, one of the standard enumerator interfaces that contain the Next, Reset, Clone, and Skip methods. IEnumSTATSTG enumerates the data stored in an array of STATSTG structures.

The storage object must be open in read mode to allow the enumeration of its elements.

The enumerator object is permitted to enumerate the elements in any order. The enumerator object is also permitted to treat the enumeration as a snapshot or to have the enumeration reflect the current state of the storage object.


Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps | UWP apps]
Minimum supported server Windows 2000 Server [desktop apps | UWP apps]
Target Platform Windows
Header objidl.h
Library Uuid.lib
DLL Ole32.dll

See also


IStorage - Compound File Implementation