IOleDocumentView::SetInPlaceSite

Associates a container's document view site with a document's document view object.

HRESULT SetInPlaceSite(
  IOleInPlaceSite * pIPSite  // Pointer to document view site's 
                             // IOleInPlaceSite interface
);
 

Parameters

pIPSite
[in] Pointer to the document view site's IOleInPlaceSite interface. Can be NULL, in which case the document view object loses all asociation with the container.

Return Values

This method supports the standard return value E_FAIL, as well as the following:

S_OK
A document view site was successfully associated (or disassociated if pIPSite is NULL) with a document view object.

Remarks

As part of activating a document object, a container must pass the object a pointer to the container's implementation of IOleInPlaceSite. This pointer designates the document view site that is to be associated with the view on which this method is called.

A container normally passes this pointer in response to a document's request to be activated. A document makes such a request by calling IOleDocumentSite::ActivateMe and passing the container a pointer to the view to be activated. The container, in turn, uses this pointer to call SetInPlaceSite.

Notes to Callers

If the container is requesting creation and activation of a new instance of a document object, rather than merely the activation of a loaded instance of a document object, the view site is passed in the pIPSite argument of IOleDocument::CreateView. Therefore, an explicit call to SetInPlaceSite is unnecessary.

Notes to Implementers

If this method is called on a view that is already associated with a view site, the view must do some housekeeping in preparation for activating itself in the new site. First, the view must deactivate itself in the current site and release its pointer to that site. Next, if the new IOleInPlaceSite pointer is not NULL, the view should both save the pointer and call AddRef on it. The view should then wait for the container to tell it when to activate itself in the new view site.

A document view must implement this method completely; E_NOTIMPL is not an acceptable return value.

QuickInfo

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

See Also

IOleDocumentView::GetInPlaceSite