# IOleDocumentView::ApplyViewState

Instructs a view to reinitialize itself according to the data in a stream that was previously written by means of a call to IOleDocumentView::SaveViewState.

HRESULT ApplyViewState(

IStream *pstm | // Pointer to stream
); |

Parameters

pstm
  [in] Pointer to the stream from which the view should load its state.

Return Values

S_OK
  The view successfully loaded its state from the specified stream.
E_POINTER
  The value in pstm is NULL.
E_NOTIMPL
  This view has no meaningful state to load. This error should be rare because most views will have at least some state information worth loading.

Remarks

Typically, this function is called after an existing view has been created in the container but before that view has been displayed. It is the responsibility of the view to validate the data in the view stream; the container does not attempt to interpret view-state stream data.

The semantics of ApplyViewState are encompassed in the pstm argument of IOleDocument::CreateView.

See Also

IOleDocument::CreateView, IOleDocumentView::SaveViewState