IOleDocument::EnumViews method

Creates an object that enumerates the views supported by a document object, or if only one view is supported, returns a pointer to that view.


HRESULT EnumViews(
  [out] IEnumOleDocumentViews **ppEnum,
  [out] IOleDocumentView      **ppView


ppEnum [out]

A pointer to an IEnumOleDocumentViews pointer variable that receives the interface pointer to the enumerator object.

ppView [out]

A pointer to an IOleDocumentView pointer variable that receives the interface pointer to a single view object.

Return value

This method returns S_OK if the object supports multiple views, then ppEnum contains a pointer to the enumerator object, and ppView is NULL. Otherwise, ppEnum is NULL, and ppView contains an interface pointer on the single view.

Other possible return values include the following.

Return codeDescription

Insufficient memory available for the operation.


The address in ppEnum or ppView is invalid. The caller must pass valid pointers for both arguments.


Notes to Callers

Call this method to determine if a document object supports more than one view of its data. If it does, the caller can use the pointer written to ppEnum to specify which view to activate. When finished with the pointer, the caller must free it by calling IUnknown::Release.

Notes to Implementers

This method must be completely implemented on all document objects; E_NOTIMPL is not an acceptable return value.


If a document object supports multiple views of its data, it must also implement IEnumOleDocumentViews and pass that interface's pointer in the out parameter ppEnum. Using this pointer, the container can enumerate the views supported by the document object.

If the document object supports only a single view, IOleDocument::EnumViews passes that view's IOleDocumentView pointer in the out parameter ppView.


Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]






IID_IOleDocument is defined as b722bcc5-4e68-101b-a2bc-00aa00404770

See also