Contents Index Topic Contents | ||
Previous Topic: IOleDocumentView::SaveViewState Next Topic: IOleDocumentView::SetRect |
IOleDocumentView::SetInPlaceSite
HRESULT SetInPlaceSite( IOleInPlaceSite * pIPSite );Associates a container's document view site with a document's document view object.
- Returns S_OK if successful, or E_FAIL otherwise.
- pIPSite
- [in] Address of the document view site's IOleInPlaceSite interface. Can be NULL, in which case the document view object loses all association with the container.
As part of activating an Active Document, 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 IOleDocumentView::SetInPlaceSite.
Notes to Callers
If the container is requesting creation and activation of a new instance of an Active Document, rather than merely the activation of a loaded instance of an Active Document, the view site is passed in the pIPSite argument of IOleDocument::CreateView. Therefore, an explicit call to IOleDocumentView::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 IUnknown::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.
See also IOleDocumentView::GetInPlaceSite
Top of Page
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.