IVsSimpleObjectList2.GetContextMenu Method

Allows the list to provide a different context menu and IOleCommandTarget for the given list item.

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

Syntax

‘선언
Function GetContextMenu ( _
    index As UInteger, _
    <OutAttribute> ByRef pclsidActive As Guid, _
    <OutAttribute> ByRef pnMenuId As Integer, _
    <OutAttribute> ByRef ppCmdTrgtActive As IOleCommandTarget _
) As Integer
‘사용 방법
Dim instance As IVsSimpleObjectList2
Dim index As UInteger
Dim pclsidActive As Guid
Dim pnMenuId As Integer
Dim ppCmdTrgtActive As IOleCommandTarget
Dim returnValue As Integer

returnValue = instance.GetContextMenu(index, _
    pclsidActive, pnMenuId, ppCmdTrgtActive)
int GetContextMenu(
    uint index,
    out Guid pclsidActive,
    out int pnMenuId,
    out IOleCommandTarget ppCmdTrgtActive
)
int GetContextMenu(
    [InAttribute] unsigned int index, 
    [OutAttribute] Guid% pclsidActive, 
    [OutAttribute] int% pnMenuId, 
    [OutAttribute] IOleCommandTarget^% ppCmdTrgtActive
)
abstract GetContextMenu : 
        index:uint32 * 
        pclsidActive:Guid byref * 
        pnMenuId:int byref * 
        ppCmdTrgtActive:IOleCommandTarget byref -> int 
function GetContextMenu(
    index : uint, 
    pclsidActive : Guid, 
    pnMenuId : int, 
    ppCmdTrgtActive : IOleCommandTarget
) : int

Parameters

  • index
    Type: System.UInt32
    [in] Specifies the index of the list item of interest.
  • pclsidActive
    Type: System.Guid%
    [out] Specifies the CLSID of the menu group containing your menu.
  • pnMenuId
    Type: System.Int32%
    [out] Pointer to an integer containing the menu id.

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

HRESULT IVsSimpleObjectList2::GetContextMenu(
   [in]  ULONG               Index, 
   [out] CLSID              *pclsidActive, 
   [out] LONG               *pnMenuId, 
   [out] IOleCommandTarget **ppCmdTrgtActive
);

This method applies to the ClassView tool only. You can use this method to specify an alternate context menu and an IOleCommandTarget to handle the commands on the menu when the list item is selected. This IOleCommandTarget gets first priority at handling the command.

참고

When multiple items are selected in ClassView, this alternate context menu is not used.

.NET Framework Security

See Also

Reference

IVsSimpleObjectList2 Interface

IVsSimpleObjectList2 Members

Microsoft.VisualStudio.Shell.Interop Namespace