IOleDocumentView::CloseView method (docobj.h)

Instructs a document view to close itself and release its IOleInPlaceSite pointer.

Syntax

HRESULT CloseView(
  [in] DWORD dwReserved
);

Parameters

[in] dwReserved

This parameter is reserved and cannot be NULL.

Return value

This method returns S_OK on success.

Remarks

When a separate window is no longer needed, the container calls IOleDocumentView::CloseView, whereupon the view releases its site pointer to the separate window and destroys the window. Unlike the normal in-place deactivation sequence for active documents, a document view continues to hold the IOleInPlaceSite pointer. This pointer is released only when the view's container calls SetInPlaceSite, with pIPSite set to NULL, or calls IOleDocumentView::CloseView.

When a user closes a view's separate window, the view should not shut itself down. Instead, it should call IOleInPlaceSite::OnInPlaceActivate. The view site then decides whether to call IOleDocumentView::UIActivate with FALSE immediately or later. In this way, a document view displayed in a separate window remains available for activation in the container's own window.

The container must call this method before it deletes the view, that is, releases its last reference to the view. In general, implementation of this method will call IOleDocumentView::Show with FALSE to hide the view if it is not already hidden, then call SetInPlaceSite with NULL to deactivate itself and release the view site pointer.

Because IOleDocumentView::CloseView is called when a container is going to completely shut down a view, this method must be implemented and has no reason to fail.

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

IOleDocumentView

IOleDocumentView::SetInPlaceSite

IOleDocumentView::Show