共用方式為


IVsUIShell.ShowContextMenu Method

Shows the context menu for the active menu object.

Namespace:  Microsoft.VisualStudio.Shell.Interop
Assembly:  Microsoft.VisualStudio.Shell.Interop (in Microsoft.VisualStudio.Shell.Interop.dll)

Syntax

'宣告
Function ShowContextMenu ( _
    dwCompRole As UInteger, _
    ByRef rclsidActive As Guid, _
    nMenuId As Integer, _
    pos As POINTS(), _
    pCmdTrgtActive As IOleCommandTarget _
) As Integer
'用途
Dim instance As IVsUIShell
Dim dwCompRole As UInteger
Dim rclsidActive As Guid
Dim nMenuId As Integer
Dim pos As POINTS()
Dim pCmdTrgtActive As IOleCommandTarget
Dim returnValue As Integer

returnValue = instance.ShowContextMenu(dwCompRole, _
    rclsidActive, nMenuId, pos, pCmdTrgtActive)
int ShowContextMenu(
    uint dwCompRole,
    ref Guid rclsidActive,
    int nMenuId,
    POINTS[] pos,
    IOleCommandTarget pCmdTrgtActive
)
int ShowContextMenu(
    [InAttribute] unsigned int dwCompRole, 
    [InAttribute] Guid% rclsidActive, 
    [InAttribute] int nMenuId, 
    [InAttribute] array<POINTS>^ pos, 
    [InAttribute] IOleCommandTarget^ pCmdTrgtActive
)
abstract ShowContextMenu : 
        dwCompRole:uint32 * 
        rclsidActive:Guid byref * 
        nMenuId:int * 
        pos:POINTS[] * 
        pCmdTrgtActive:IOleCommandTarget -> int 
function ShowContextMenu(
    dwCompRole : uint, 
    rclsidActive : Guid, 
    nMenuId : int, 
    pos : POINTS[], 
    pCmdTrgtActive : IOleCommandTarget
) : int

Parameters

  • rclsidActive
    Type: System.Guid%
    [in] Specifies the GUID of the context menu in the .ctc file.
  • nMenuId
    Type: System.Int32
    [in] Identifier of the context menu to show from the .ctc file.

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 vsshell.idl:

HRESULT IVsUIShell::ShowContextMenu(
   [in] DWORD dwCompRole,
   [in] REFCLSID rclsidActive,
   [in] LONG nMenuId,
   [in] REFPOINTS pos,
   [in] IOleCommandTarget *pCmdTrgtActive
);

All commands are routed first to the IOleCommandTarget passed in pCmdTrgtActive.

.NET Framework Security

See Also

Reference

IVsUIShell Interface

IVsUIShell Members

Microsoft.VisualStudio.Shell.Interop Namespace