Contents Previous Page Next Page
IOleDocumentView::SaveViewState

Saves the view's state into the specified stream.

HRESULT SaveViewState(

    IStream *
pstm      // Pointer to stream     
                                                
   );                                           
                                                

Parameters

pstm

[in] Pointer to stream in which the view is to save its state.

Return Values

S_OK

The view successfully saved its state to the specified stream.

E_POINTER

The value in pstm is NULL.

E_NOTIMPL

This view has no meaningful state to save. This error should be rare because most views have at least some state information worth saving.

Remarks

The view's state includes properties such as the view type, zoom factor, and insertion point. The container typically calls this function before deactivating the view. The stream can then later be used to reinitialize a view of the same document to this saved state through IOleDocumentView_ApplyViewState.

According to the rules governing IPersistStream, a view must write its CLSID as the first element in the stream. Any cross-platform file format compatibility issues that apply to the documentÆs storage representation also apply to this context.

See Also

IOleDocumentView_ApplyViewState, IPersistStream