Creates a document view object in the caller’s process and returns a pointer to that object’s IOleDocumentView interface.
HRESULT CreateView(
IOleInPlaceSite * pIPSite, |
// Pointer to container’s view-site object |
IStream * pstm, |
// Pointer to a stream object |
DWORD dwReserved, |
// Reserved for future use |
IOleDocumentView * ppView |
// Indirect pointer to the new document view object |
); |
Parameters
Return Values
Remarks
A document-object container’s document site calls IOleDocumentView::CreateView to instruct a document object to create a new view of itself in the container’s process, either from scratch or by using the contents of an existing stream.
Calling CreateView does not cause the new view to display itself. To do so, the view must wait for calls to either IOleDocumentView::Show or IOleDocumentView::UIActivate.
The call to CreateView normally occurs in the container’s implementation of IOleDocumentSite::ActivateMe. If a document object passes an IOleDocumentView pointer in its call to ActivateMe, the container has no need to call CreateView and instead can call IOleDocumentView::SetInPlaceSite, followed by AddRef. If a document object returns a NULL view pointer in its call to ActivateMe, then the container calls CreateView to retrieve a view pointer.
The container has the option of passing a pointer to a stream containing data to be used to initialize the requested view. If the container passes a NULL stream pointer, then the document object will initialize the new view using its default settings.
This method must be completely implemented for any document object. Therefore E_NOTIMPL is not an acceptable return value.
If pIPSite is non-NULL, then the document object should pass the pointer to the new view through IOleDocumentView::SetInPlaceSite. If pIPSite is NULL, the caller is responsible for making this same call. In addition, if pstm is non-NULL, then the object should initialize the view object by passing pstm to IOleDocumentView::ApplyViewState.
As with all new interface pointers, CreateView should call AddRef on the pointer in *ppView before returning. The caller is responsible for calling Release through this pointer when it is no longer needed.
See Also
IOleDocumentSite::ActivateMe, IOleDocumentView::ApplyViewState, IOleDocumentView::SetInPlaceSite, IOleDocumentView::Show, IOleDocumentView::UIActivate