IVsObjectList2.GetContextMenu(UInt32, Guid, Int32, IOleCommandTarget) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Allows the list to provide a different context menu and IOleCommandTarget for the given list item.
public:
int GetContextMenu(System::UInt32 index, [Runtime::InteropServices::Out] Guid % pclsidActive, [Runtime::InteropServices::Out] int % pnMenuId, [Runtime::InteropServices::Out] Microsoft::VisualStudio::OLE::Interop::IOleCommandTarget ^ % ppCmdTrgtActive);
public int GetContextMenu (uint index, out Guid pclsidActive, out int pnMenuId, out Microsoft.VisualStudio.OLE.Interop.IOleCommandTarget ppCmdTrgtActive);
abstract member GetContextMenu : uint32 * Guid * int * IOleCommandTarget -> int
Public Function GetContextMenu (index As UInteger, ByRef pclsidActive As Guid, ByRef pnMenuId As Integer, ByRef ppCmdTrgtActive As IOleCommandTarget) As Integer
Parameters
- index
- UInt32
[in] Specifies the index of the list item of interest.
- pclsidActive
- Guid
[out] Specifies the CLSID of the menu group containing your menu.
- pnMenuId
- Int32
[out] Pointer to an integer containing the menu id.
- ppCmdTrgtActive
- IOleCommandTarget
[out] Pointer to the list's or the library's IOleCommandTarget
interface.
Returns
If the method succeeds, it returns S_OK. If it fails, it returns an error code.
Remarks
COM Signature
From vsshell80.idl:
[C++]
HRESULT IVsObjectList2::GetContextMenu(
[in] ULONG Index,
[out] CLSID *pclsidActive,
[out] LONG *pnMenuId,
ut] 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.
Note
When multiple items are selected in ClassView, this alternate context menu is not used.