Provides a direct channel of communication between the object and each of the frame and document windows.
HRESULT SetActiveObject(
IOleInPlaceActiveObject *pActiveObject,
//Pointer to active in-place object
LPCOLESTR pszObjName //Pointer tostring containing a name
// describing the object
);
This method supports the standard return values E_INVALIDARG and E_UNEXPECTED, as well as the following:
Generally, an embedded object should pass NULL for the pszObjName parameter (see "Notes to Implementers" below). However, if you are working in conjunction with a container that does display the name of the in-place active object in its title bar, then you should compose a string in the following form:
<application name> – <object short-type name>
IOleInPlaceUIWindow::SetActiveObject is called by the object to establish a direct communication link between itself and the document and frame windows.
When deactivating, the object calls IOleInPlaceUIWindow::SetActiveObject, passing NULL for the pActiveObject and pszObjName parameters.
An object must call IOleInPlaceUIWindow::SetActiveObject before calling IOleInPlaceFrame::SetMenu to give the container the pointer to the active object. The container then uses this pointer in processing IOleInPlaceFrame::SetMenu and to pass to OleSetMenuDescriptor.
The Microsoft Windows User Interface Design Guide recommends that an in-place container ignore the pszObjName parameter passed in this method. The guide says "The title bar is not affected by in-place activation. It always displays the top-level container's name."
Windows NT: Use version 3.1 or later.
Windows: Use Windows 95 or later.
Windows CE: Unsupported.
Header: Declared in oleidl.h.
IOleInPlaceFrame::SetMenu, OleSetMenuDescriptor