IVsMenuEditor::AddMenuItem Method (IVsMenuItem^, IVsMenuItem^, IVsMenuItem^)

 

Adds a new menu item.

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

int AddMenuItem(
	IVsMenuItem^ pIMI,
	IVsMenuItem^ pIMIParent,
	IVsMenuItem^ pIMIInsertAfter
)

Parameters

pIMI
Type: Microsoft.VisualStudio.Shell.Interop::IVsMenuItem^

[in] The menu item to be added.

pIMIParent
Type: Microsoft.VisualStudio.Shell.Interop::IVsMenuItem^

[in] The parent menu item of the new menu item being added.

pIMIInsertAfter
Type: Microsoft.VisualStudio.Shell.Interop::IVsMenuItem^

[in] The location in the menu to place the new menu item.

Return Value

Type: System::Int32

If the method succeeds, it returns S_OK. If it fails, it returns an error code.

Set pIMIParent and pIMIInsertAfter to null to place the new menu item as the first item in the top-level menu. Otherwise, only pIMIParent or pIMIInsertAfter can be valid.

From vsshell.idl:

HRESULT IVsMenuEditor::AddMenuItem(
   [in]IVsMenuItem *pIMI, [in]IVsMenuItem *pIMIParent, [in]IVsMenuItem *pIMIInsertAfter);

Only pIMIParent and pIMIInsertAfter can be null for first item in top-level menu. Otherwise, only pIMIParent or pIMIInsertAfter can be valid

Return to top
Show: