Creates a document view object in the caller's process and obtains 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
//Address of output variable that receives the
// IOleDocumentView interface pointer
);
This method supports the standard return values E_FAIL, E_OUTOFMEMORY, and E_UNEXPECTED, as well as the following:
A document object container's document site calls IOleDocument::CreateView to instruct a document object to create a new view of itself in the container's process, either from default data or using the contents of an existing stream.
Calling CreateView does not cause the new view to display itself. To do so requires a call to either IOleDocumentView::Show or IOleDocumentView::UIActivate.
CreateView is normally called by 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 passes a NULL 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 used to initialize the requested view. If the container passes a NULL stream pointer, the document object will initialize the new view using its default settings.
This method must be completely implemented for any document object; E_NOTIMPL is not an acceptable return value.
If pIPSite is not NULL, then the document object should pass the pointer to the new view in a call to IOleDocumentView::SetInPlaceSite. If pIPSite is NULL, the caller is responsible for making this same call. In addition, if pstm is not NULL, then the document object should initialize the view object by passing pstm in a call 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 on this pointer when it is no longer needed.
Windows NT: Use version 5.0 or later.
Windows: Unsupported.
Windows CE: Unsupported.
Header: Declared in docobj.h.
IOleDocumentSite::ActivateMe, IOleDocumentView::ApplyViewState, IOleDocumentView::SetInPlaceSite, IOleDocumentView::Show, IOleDocumentView::UIActivate