IOleDocumentView::Close

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

HRESULT Close(
  DWORD dwReserved  // Reserved. Must be zero
);
 

Return Values

S_OK
The view successfully closed itself.

Remarks

When a separate window is no longer needed, the container calls Close, 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 Close.

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 UIActivate(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 Show(FALSE) to hide the view if it is not already hidden, then call SetInPlaceSite(NULL) to deactivate itself and release the view site pointer.

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

QuickInfo

  Windows NT: Use version 5.0 or later.
  Windows: Unsupported.
  Windows CE: Unsupported.
  Header: Declared in docobj.h.

See Also

IOleDocumentView::SetInPlaceSite, IOleDocumentView::Show