This documentation is archived and is not being maintained.

IOleInPlaceComponentUIManager.UIActivateForMe Method

Requests that the SOleComponentUIManager service participate in the activation or deactivation of an in-place VSPackage object.

Namespace: Microsoft.VisualStudio.Shell.Interop
Assembly: Microsoft.VisualStudio.Shell.Interop (in microsoft.visualstudio.shell.interop.dll)

int UIActivateForMe (
	[InAttribute] uint dwCompRole,
	[InAttribute] ref Guid rclsidActive,
	[InAttribute] IOleInPlaceActiveObject pIPActObj,
	[InAttribute] IOleCommandTarget pCmdTrgtActive,
	[InAttribute] uint cCmdGrpId,
	[InAttribute] int[] rgnCmdGrpId
)
int UIActivateForMe (
	/** @attribute InAttribute() */ UInt32 dwCompRole, 
	/** @attribute InAttribute() */ /** @ref */ Guid rclsidActive, 
	/** @attribute InAttribute() */ IOleInPlaceActiveObject pIPActObj, 
	/** @attribute InAttribute() */ IOleCommandTarget pCmdTrgtActive, 
	/** @attribute InAttribute() */ UInt32 cCmdGrpId, 
	/** @attribute InAttribute() */ int[] rgnCmdGrpId
)
JScript does not support passing value-type arguments by reference.

Parameters

dwCompRole

[in] Role of the in-place VSPackage object that is either activating or deactivating. For valid dwCompRole values, see OLEROLE.

rclsidActive

[in] Class identifier (CLSID) of the in-place VSPackage object that is either activating or deactivating.

pIPActObj

[in] Pointer to the IOleInPlaceActiveObject interface of the innermost active object. The pIPActObj parameter must be a null reference (Nothing in Visual Basic) when the in-place object is deactivating and a valid interface pointer when it is activating.

pCmdTrgtActive

[in] Pointer to the IOleCommandTarget interface to handle the dispatching of active in-place object commands. The pCmdTrgtActive parameter must be null when the in-place object is deactivating and a valid interface pointer when it is activating.

cCmdGrpId

[in] Count of custom toolbar identifiers in the rgnCmdGrpId parameter.

rgnCmdGrpId

[in] Array of identifiers for the custom toolbar to be displayed by the SOleComponentUIManager service.

Return Value

If the method succeeds, it returns S_OK. If it fails, it returns an error code.

COM Signature

From oleipc.idl:

HRESULT IOleInPlaceComponentUIManager::UIActivateForMe(
   [in] DWORD dwCompRole,
   [in] REFCLSID rclsidActive,
   [in] IOleInPlaceActiveObject *pIPActObj,
   [in] IOleCommandTarget *pCmdTrgtActive,
   [in] ULONG cCmdGrpId,
   [in] LONG *rgnCmdGrpId
);

UIActivateForMe is the primary method that differentiates the use of the SOleComponentUIManager service with traditional OLE in-place activation. When an in-place VSPackage object calls UIActivateForMe, the SOleComponentUIManager service takes all the necessary steps to integrate the object's menus, toolbars, and commands into the environment. The object does not need to participate in negotiation for border space to enable menu merging as is necessary in OLE in-place activation.

UIActivateForMe is a logical replacement for the SetActiveObject method in the IOleInPlaceFrame interface. The in-place VSPackage object passes its pIPActObj pointer to the environment in this method instead of through the container's UIActivateForMe method as is done in standard OLE in-place activation.

To implement UIActivateForMe, coordinate this method with the implementation of UIActivateForMe method in the IOleInPlaceFrame interface. The effect of this call is similar to an OLE object calling:

IOleInPlaceUIWindow::SetActiveObject(pActiveObj);

IOleInPlaceFrame::SetMenu(null);

IOleInPlaceUIWindow::SetBorderSpace(null);

When an in-place VSPackage object takes focus by calling UIActivateForMe, the SOleComponentUIManager service replaces any custom menus and toolbars displayed on behalf of the previous active object with those of the new active object. If the new object loses focus or a nested object takes focus, these menus and toolbars are removed.

Show: