Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
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
- 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: 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
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.