Share via


IOleInPlaceComponentUIManager.UIActivateForMe Method

Definition

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

public:
 int UIActivateForMe(System::UInt32 dwCompRole, Guid % rclsidActive, Microsoft::VisualStudio::OLE::Interop::IOleInPlaceActiveObject ^ pIPActObj, Microsoft::VisualStudio::OLE::Interop::IOleCommandTarget ^ pCmdTrgtActive, System::UInt32 cCmdGrpId, cli::array <int> ^ rgnCmdGrpId);
public int UIActivateForMe (uint dwCompRole, ref Guid rclsidActive, Microsoft.VisualStudio.OLE.Interop.IOleInPlaceActiveObject pIPActObj, Microsoft.VisualStudio.OLE.Interop.IOleCommandTarget pCmdTrgtActive, uint cCmdGrpId, int[] rgnCmdGrpId);
abstract member UIActivateForMe : uint32 * Guid * Microsoft.VisualStudio.OLE.Interop.IOleInPlaceActiveObject * Microsoft.VisualStudio.OLE.Interop.IOleCommandTarget * uint32 * int[] -> int
Public Function UIActivateForMe (dwCompRole As UInteger, ByRef rclsidActive As Guid, pIPActObj As IOleInPlaceActiveObject, pCmdTrgtActive As IOleCommandTarget, cCmdGrpId As UInteger, rgnCmdGrpId As Integer()) As Integer

Parameters

dwCompRole
UInt32

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

rclsidActive
Guid

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

pIPActObj
IOleInPlaceActiveObject

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

pCmdTrgtActive
IOleCommandTarget

[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
UInt32

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

rgnCmdGrpId
Int32[]

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

Returns

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

Remarks

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.

Applies to