IOleDocumentView::Clone

Creates a duplicate view object with an identical internal state to the current view.

HRESULT Clone(

IOleInPlaceSite *pIPSiteNew

// Pointer to view site

IOleDocumentView **ppViewNew

// On return, pointer to interface pointer to view object

);

Parameters

pIPSiteNew
[in] Pointer to the in-place site in which the view to be cloned will be activated. The view being cloned should pass this pointer to the cloned view’s IOleDocumentView::SetInPlaceSite method. This pointer can be NULL, in which case the caller is responsible for calling SetInPlaceSite on this new view directly.ppViewNew

[out] Indirect pointer to the new view object’s IOleDocumentView interface. The caller is responsible for this pointer any must release it when it is no longer needed.

Return Values

S_OK
The view was successfully cloned.
E_POINTER
The value in ppViewNew is NULL.]
E_NOTIMPL
The view object does not implement this interface.
E_FAIL
The document object does not implement this interface.

This is useful for creating a new view with a different view port and view site but with the same view context as the view being cloned. Typically this will be used to implement the “Window-New window” functionality.

Remarks

This method is useful for creating a new view with a different view port and view site but with the same view context as the view being cloned. Typically, containers hosting an MDI application will call this method to provide “Window/New window” capability.

See Also

IOleDocumentView, IOleDocumentView::SetInPlaceSite