Share via


IVsMenuEditor.AddMenuItem(IVsMenuItem, IVsMenuItem, IVsMenuItem) Method

Definition

Adds a new menu item.

public:
 int AddMenuItem(Microsoft::VisualStudio::Shell::Interop::IVsMenuItem ^ pIMI, Microsoft::VisualStudio::Shell::Interop::IVsMenuItem ^ pIMIParent, Microsoft::VisualStudio::Shell::Interop::IVsMenuItem ^ pIMIInsertAfter);
public:
 int AddMenuItem(Microsoft::VisualStudio::Shell::Interop::IVsMenuItem ^ pIMI, Microsoft::VisualStudio::Shell::Interop::IVsMenuItem ^ pIMIParent, Microsoft::VisualStudio::Shell::Interop::IVsMenuItem ^ pIMIInsertAfter);
int AddMenuItem(Microsoft::VisualStudio::Shell::Interop::IVsMenuItem const & pIMI, Microsoft::VisualStudio::Shell::Interop::IVsMenuItem const & pIMIParent, Microsoft::VisualStudio::Shell::Interop::IVsMenuItem const & pIMIInsertAfter);
public int AddMenuItem (Microsoft.VisualStudio.Shell.Interop.IVsMenuItem pIMI, Microsoft.VisualStudio.Shell.Interop.IVsMenuItem pIMIParent, Microsoft.VisualStudio.Shell.Interop.IVsMenuItem pIMIInsertAfter);
abstract member AddMenuItem : Microsoft.VisualStudio.Shell.Interop.IVsMenuItem * Microsoft.VisualStudio.Shell.Interop.IVsMenuItem * Microsoft.VisualStudio.Shell.Interop.IVsMenuItem -> int
Public Function AddMenuItem (pIMI As IVsMenuItem, pIMIParent As IVsMenuItem, pIMIInsertAfter As IVsMenuItem) As Integer

Parameters

pIMI
IVsMenuItem

[in] The menu item to be added.

pIMIParent
IVsMenuItem

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

pIMIInsertAfter
IVsMenuItem

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

Returns

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

Remarks

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.

COM Signature

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

Applies to