Edit

Share via


IOleDocument::CreateView method (docobj.h)

Creates a document view object in the caller's process and obtains a pointer to that object's IOleDocumentView interface.

Syntax

HRESULT CreateView(
  [in]  IOleInPlaceSite  *pIPSite,
  [in]  IStream          *pstm,
  [in]  DWORD            dwReserved,
  [out] IOleDocumentView **ppView
);

Parameters

[in] pIPSite

A pointer to the IOleInPlaceSite interface that represents the view site object to be associated with the new document view object. This parameter can be NULL, for example, when the view is contained in a new, uninitialized document object, in which case the caller must initialize the view with a subsequent call to IOleDocumentView::SetInPlaceSite.

[in] pstm

A pointer to a stream containing data from which the new document view object should initialize itself. If NULL, the document object initializes the new document view object with a default state.

[in] dwReserved

This parameter is reserved and must be zero.

[out] ppView

A pointer to an IOleDocumentView pointer variable that receives the interface pointer to the new document view object. When successful, the caller is responsible for calling IUnknown::Release on the ppview pointer when the view object is no longer needed.

Return value

This method returns S_OK on success. Other possible return values include the following.

Return code Description
E_FAIL
The operation failed.
E_OUTOFMEMORY
Insufficient memory available for the operation.
E_UNEXPECTED
An unexpected error has occurred.
E_POINTER
The address in ppView is NULL.

Remarks

A document object container's document site calls 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.

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header docobj.h

See also

IOleDocument

IOleDocumentSite::ActivateMe

IOleDocumentView::ApplyViewState

IOleDocumentView::SetInPlaceSite

IOleDocumentView::Show

IOleDocumentView::UIActivate