IOleDocument::EnumViews

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(

IEnumOleDocumentViews ** ppEnum,

// On return, pointer to interface pointer to an enumerator

IOleDocumentView ** ppView

// On return, pointer to interface pointer to a single view

);

Parameters

ppEnum
[out] Indirect pointer to the enumerator’s IEnumOleDocumentViews interface.
ppView
[out] Indirect pointer to a single view object’s IOleDocumentView interface.

Return Value

S_OK
If the object supports multiple views, then *ppEnum contains the enumerator pointer. Otherwise *ppEnum is NULL and *ppView contains the interface pointer to the single view.
E_POINTER
The address in ppEnum or ppView is invalid. The caller must pass pointers for both arguments.
E_OUTOFMEMORY
The enumerator could not be created because there is insufficient memory.

Remarks

If a document object supports multiple views of its data, it must also implement IEnumOleDocumentViews and return 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 returns that view’s IOleDocumentView pointer in the out parameter *ppView.

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 returned in *ppEnum to specify which view to activate. When finished with the pointer, the caller must free it by calling Release.

Notes to Implementers

This method must be completely implemented on all document objects; E_NOTIMPL is not an acceptable return value. The way in which this method should be implemented depends on whether the document object in question supports multiple views or only a single view.

See Also

IEnumOleDocumentViews, IOleDocumentView