IVsSimpleObjectList2::GetContextMenu Method (UInt32, Guid, Int32, IOleCommandTarget^)

 

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)

int GetContextMenu(
	unsigned int index,
	[OutAttribute] Guid% pclsidActive,
	[OutAttribute] int% pnMenuId,
	[OutAttribute] IOleCommandTarget^% ppCmdTrgtActive
)

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.

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.

System_CAPS_noteNote

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

Return to top
Show: