Поделиться через


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)

Syntax

'Declaration
Function UIActivateForMe ( _
    dwCompRole As UInteger, _
    ByRef rclsidActive As Guid, _
    pIPActObj As IOleInPlaceActiveObject, _
    pCmdTrgtActive As IOleCommandTarget, _
    cCmdGrpId As UInteger, _
    rgnCmdGrpId As Integer() _
) As Integer
int UIActivateForMe(
    uint dwCompRole,
    ref Guid rclsidActive,
    IOleInPlaceActiveObject pIPActObj,
    IOleCommandTarget pCmdTrgtActive,
    uint cCmdGrpId,
    int[] rgnCmdGrpId
)
int UIActivateForMe(
    [InAttribute] unsigned int dwCompRole, 
    [InAttribute] Guid% rclsidActive, 
    [InAttribute] IOleInPlaceActiveObject^ pIPActObj, 
    [InAttribute] IOleCommandTarget^ pCmdTrgtActive, 
    [InAttribute] unsigned int cCmdGrpId, 
    [InAttribute] array<int>^ rgnCmdGrpId
)
abstract UIActivateForMe : 
        dwCompRole:uint32 * 
        rclsidActive:Guid byref * 
        pIPActObj:IOleInPlaceActiveObject * 
        pCmdTrgtActive:IOleCommandTarget * 
        cCmdGrpId:uint32 * 
        rgnCmdGrpId:int[] -> int 
function UIActivateForMe(
    dwCompRole : uint, 
    rclsidActive : Guid, 
    pIPActObj : IOleInPlaceActiveObject, 
    pCmdTrgtActive : IOleCommandTarget, 
    cCmdGrpId : uint, 
    rgnCmdGrpId : int[]
) : int

Parameters

  • dwCompRole
    Type: System.UInt32
    [in] Role of the in-place VSPackage object that is either activating or deactivating. For valid dwCompRole values, see OLEROLE.
  • rclsidActive
    Type: System.Guid%
    [in] Class identifier (CLSID) of the in-place VSPackage object that is either activating or deactivating.
  • cCmdGrpId
    Type: System.UInt32
    [in] Count of custom toolbar identifiers in the rgnCmdGrpId parameter.

Return Value

Type: System.Int32
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.

.NET Framework Security

See Also

Reference

IOleInPlaceComponentUIManager Interface

Microsoft.VisualStudio.Shell.Interop Namespace