共用方式為


IVsProfferCommands3.AddNamedCommand2 Method

Definition

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

public:
 int AddNamedCommand2(Guid % pguidPackage, Guid % pguidCmdGroup, System::String ^ pszCmdNameCanonical, [Runtime::InteropServices::Out] System::UInt32 % pdwCmdId, System::String ^ pszCmdNameLocalized, System::String ^ pszBtnText, System::String ^ pszCmdTooltip, System::String ^ pszSatelliteDLL, System::UInt32 dwBitmapResourceId, System::UInt32 dwBitmapImageIndex, System::UInt32 dwCmdFlagsDefault, System::UInt32 cUIContexts, cli::array <Guid> ^ rgguidUIContexts, System::UInt32 dwUIElementType);
public 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);
abstract member AddNamedCommand2 : Guid * Guid * string * uint32 * string * string * string * string * uint32 * uint32 * uint32 * uint32 * Guid[] * uint32 -> int
Public Function AddNamedCommand2 (ByRef pguidPackage As Guid, ByRef pguidCmdGroup As Guid, pszCmdNameCanonical As String, 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

Parameters

pguidPackage
Guid

[in] The package GUID. Use null for addins.

pguidCmdGroup
Guid

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

pszCmdNameCanonical
String

[in] The full name of the command.

pdwCmdId
UInt32

[outThe ID for the new command.

pszCmdNameLocalized
String

[in] A localized version of the string. May be null.

pszBtnText
String

[in] The text to display on a button. Use null if the added command isn't a button.

pszCmdTooltip
String

[in] The ToolTip text to display. May be null.

pszSatelliteDLL
String

[in] The full path to a satellite DLL implementing the command. May be null.

dwBitmapResourceId
UInt32

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

dwBitmapImageIndex
UInt32

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

dwCmdFlagsDefault
UInt32

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

cUIContexts
UInt32

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

rgguidUIContexts
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.

dwUIElementType
UInt32

[in] Integer. A value from the vsCommandControlType enumeration.

Returns

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

Applies to