IEnumSTATSTG

The IEnumSTATSTG interface is used to enumerate through an array of STATSTG structures, which contain statistical information about an open storage, stream, or byte array object. IEnumSTATSTG has the same methods as all enumerator interfaces: Next, Skip, Reset, and Clone. For general information on these methods, refer to IEnumXXXX.

When to Implement

IEnumSTATSTG is implemented to enumerate the elements of a storage object. If you are using the compound file implementation of the storage object, a pointer to which is available through a call to StgCreateDocfile, IEnumSTATSTG is implemented on that object, and a pointer is returned through a call to IStorage::EnumElements. If you are doing a custom implementation of a storage object, you need to implement IEnumSTATSTG to fill in a caller-allocated array of STATSTG structures, each of which contains information about the nested elements in the storage object.

When to Use

Containers call methods that return a pointer to IEnumSTATSTG so the container can manage its storage object and the elements within it. Calls to the IStorage::EnumElements method supplies a pointer to IEnumSTATDATA. The caller allocates an array of STATSTG structures and the IEnumSTATSTG methods fill in each structure with the statistics about one of the nested elements in the storage object. If present, the lpszName member of the STATSTG structure requires additional memory allocations through the IMalloc interface, and the caller is responsible for freeing this memory, if it is allocated, by calling the IMalloc::Free method. If the lpszName member is NULL, no memory is allocated, and, therefore, no memory needs to be freed.

The prototypes of the methods are as follows:

HRESULT Next(
  ULONG celt,           
  STATSTG * rgelt,      
  ULONG * pceltFetched  
);
 
HRESULT Skip(
  ULONG celt  
);
 
HRESULT Reset(void)
 
HRESULT Clone(
  IEnumSTATSTG ** ppenum  
);
 

QuickInfo

  Windows NT: Use version 3.1 or later.
  Windows: Use Windows 95 or later.
  Windows CE: Unsupported.
  Header: Declared in objidl.h.

See Also

CoGetMalloc, IEnumXXXX, IStorage::EnumElements, STATSTG