Share via


IVsMenuEditor.AddMenuItem Method

Adds a new menu item.

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

Syntax

'Declaration
Function AddMenuItem ( _
    pIMI As IVsMenuItem, _
    pIMIParent As IVsMenuItem, _
    pIMIInsertAfter As IVsMenuItem _
) As Integer
int AddMenuItem(
    IVsMenuItem pIMI,
    IVsMenuItem pIMIParent,
    IVsMenuItem pIMIInsertAfter
)
int AddMenuItem(
    [InAttribute] IVsMenuItem^ pIMI, 
    [InAttribute] IVsMenuItem^ pIMIParent, 
    [InAttribute] IVsMenuItem^ pIMIInsertAfter
)
abstract AddMenuItem : 
        pIMI:IVsMenuItem * 
        pIMIParent:IVsMenuItem * 
        pIMIInsertAfter:IVsMenuItem -> int
function AddMenuItem(
    pIMI : IVsMenuItem, 
    pIMIParent : IVsMenuItem, 
    pIMIInsertAfter : IVsMenuItem
) : int

Parameters

Return Value

Type: System.Int32
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 nulla null reference (Nothing in Visual Basic) for first item in top-level menu. Otherwise, only pIMIParent or pIMIInsertAfter can be valid

.NET Framework Security

See Also

Reference

IVsMenuEditor Interface

Microsoft.VisualStudio.Shell.Interop Namespace