Partager via


IVsProfferCommands4.AddNamedCommand2 Method

Adds a named command. This version has a parameter that specifies a UI element.

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

Syntax

'Declaration
Function AddNamedCommand2 ( _
    ByRef pguidPackage As Guid, _
    ByRef pguidCmdGroup As Guid, _
    pszCmdNameCanonical As String, _
    <OutAttribute> ByRef pdwCmdId As UInteger, _
    pszCmdNameLocalized As String, _
    pszBtnText As String, _
    pszCmdTooltip As String, _
    pszSatelliteDLL As String, _
    dwBitmapResourceId As UInteger, _
    dwBitmapImageIndex As UInteger, _
    dwCmdFlagsDefault As UInteger, _
    cUIContexts As UInteger, _
    rgguidUIContexts As Guid(), _
    dwUIElementType As UInteger _
) As Integer
int AddNamedCommand2(
    ref Guid pguidPackage,
    ref Guid pguidCmdGroup,
    string pszCmdNameCanonical,
    out uint pdwCmdId,
    string pszCmdNameLocalized,
    string pszBtnText,
    string pszCmdTooltip,
    string pszSatelliteDLL,
    uint dwBitmapResourceId,
    uint dwBitmapImageIndex,
    uint dwCmdFlagsDefault,
    uint cUIContexts,
    Guid[] rgguidUIContexts,
    uint dwUIElementType
)
int AddNamedCommand2(
    [InAttribute] Guid% pguidPackage, 
    [InAttribute] Guid% pguidCmdGroup, 
    [InAttribute] String^ pszCmdNameCanonical, 
    [OutAttribute] unsigned int% pdwCmdId, 
    [InAttribute] String^ pszCmdNameLocalized, 
    [InAttribute] String^ pszBtnText, 
    [InAttribute] String^ pszCmdTooltip, 
    [InAttribute] String^ pszSatelliteDLL, 
    [InAttribute] unsigned int dwBitmapResourceId, 
    [InAttribute] unsigned int dwBitmapImageIndex, 
    [InAttribute] unsigned int dwCmdFlagsDefault, 
    [InAttribute] unsigned int cUIContexts, 
    [InAttribute] array<Guid>^ rgguidUIContexts, 
    [InAttribute] unsigned int dwUIElementType
)
abstract AddNamedCommand2 : 
        pguidPackage:Guid byref * 
        pguidCmdGroup:Guid byref * 
        pszCmdNameCanonical:string * 
        pdwCmdId:uint32 byref * 
        pszCmdNameLocalized:string * 
        pszBtnText:string * 
        pszCmdTooltip:string * 
        pszSatelliteDLL:string * 
        dwBitmapResourceId:uint32 * 
        dwBitmapImageIndex:uint32 * 
        dwCmdFlagsDefault:uint32 * 
        cUIContexts:uint32 * 
        rgguidUIContexts:Guid[] * 
        dwUIElementType:uint32 -> int
function AddNamedCommand2(
    pguidPackage : Guid, 
    pguidCmdGroup : Guid, 
    pszCmdNameCanonical : String, 
    pdwCmdId : uint, 
    pszCmdNameLocalized : String, 
    pszBtnText : String, 
    pszCmdTooltip : String, 
    pszSatelliteDLL : String, 
    dwBitmapResourceId : uint, 
    dwBitmapImageIndex : uint, 
    dwCmdFlagsDefault : uint, 
    cUIContexts : uint, 
    rgguidUIContexts : Guid[], 
    dwUIElementType : uint
) : int

Parameters

  • pguidPackage
    Type: Guid%

    [in] The package GUID. Use nulla null reference (Nothing in Visual Basic) for addins.

  • pguidCmdGroup
    Type: Guid%

    [in] The GUID for the group to receive the new command. Use GUID_Macro or GUID_AddIn defined in vbapkg.idl.

  • pszCmdNameCanonical
    Type: String

    [in] The full name of the command.

  • pdwCmdId
    Type: UInt32%

    [out] The ID for the new command.

  • pszCmdNameLocalized
    Type: String

    [in] A localized version of the string. May be nulla null reference (Nothing in Visual Basic).

  • pszBtnText
    Type: String

    [in] The text to display on a button. Use nulla null reference (Nothing in Visual Basic) if the added command isn't a button.

  • pszCmdTooltip
    Type: String

    [in] The ToolTip text to display. May be nulla null reference (Nothing in Visual Basic).

  • pszSatelliteDLL
    Type: String

    [in] The full path to a satellite DLL implementing the command. May be nulla null reference (Nothing in Visual Basic).

  • dwBitmapResourceId
    Type: UInt32

    [in] The resource identifier for the icon to display for the command. Use zero (0) if there is no bitmap.

  • dwBitmapImageIndex
    Type: UInt32

    [in] The index of the bitmap within the bitmap file.

  • dwCmdFlagsDefault
    Type: UInt32

    [in] Use zero (0) for the default values to make the command active and visible.

  • cUIContexts
    Type: UInt32

    [in] The number of contexts pointed to by the rgguidUIContexts parameter.

  • rgguidUIContexts
    Type: array<Guid[]

    [in] An array of GUIDs for the user interface contexts indicating options for displaying the command. For more information, see the UIContext_ members of VSConstants.

Return Value

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

.NET Framework Security

See Also

Reference

IVsProfferCommands4 Interface

Microsoft.VisualStudio.Shell.Interop Namespace