IVsObjectList.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 (in Microsoft.VisualStudio.Shell.Interop.dll)
Syntax
'Declaration
Function GetContextMenu ( _
index As UInteger, _
<OutAttribute> ByRef pclsidActive As Guid, _
<OutAttribute> ByRef pnMenuId As Integer, _
<OutAttribute> ByRef ppCmdTrgtActive As IOleCommandTarget _
) As Integer
'Usage
Dim instance As IVsObjectList
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.
- ppCmdTrgtActive
Type: Microsoft.VisualStudio.OLE.Interop.IOleCommandTarget%
[out] Pointer to the list's or the library's IOleCommandTarget interface.
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 IVsObjectList::GetContextMenu(
[in] ULONG Index,
[out] CLSID *pclsidActive,
[out] LONG *pnMenuId,
[out] IOleCommandTarget **ppCmdTrgtActive
);
This method applies to the Class View 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 Class View, this alternate context menu is not used.
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.