Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.

Commands2.AddNamedCommand2 Method 

Creates a named command that is saved by the environment and made available the next time the environment starts, even if the Add-in is not loaded on environment startup.

Namespace: EnvDTE80
Assembly: EnvDTE80 (in envdte80.dll)

Command AddNamedCommand2 (
	[InAttribute] AddIn AddInInstance,
	[InAttribute] string Name,
	[InAttribute] string ButtonText,
	[InAttribute] string Tooltip,
	[InAttribute] bool MSOButton,
	[OptionalAttribute] [InAttribute] Object Bitmap,
	[OptionalAttribute] [InAttribute] ref Object[] ContextUIGUIDs,
	[OptionalAttribute] [InAttribute] int vsCommandStatusValue,
	[OptionalAttribute] [InAttribute] int CommandStyleFlags,
	[OptionalAttribute] [InAttribute] vsCommandControlType ControlType
)
Command AddNamedCommand2 (
	/** @attribute InAttribute() */ AddIn AddInInstance, 
	/** @attribute InAttribute() */ String Name, 
	/** @attribute InAttribute() */ String ButtonText, 
	/** @attribute InAttribute() */ String Tooltip, 
	/** @attribute InAttribute() */ boolean MSOButton, 
	/** @attribute InAttribute() */ /** @attribute OptionalAttribute() */ Object Bitmap, 
	/** @attribute InAttribute() */ /** @attribute OptionalAttribute() */ /** @ref */ Object[] ContextUIGUIDs, 
	/** @attribute InAttribute() */ /** @attribute OptionalAttribute() */ int vsCommandStatusValue, 
	/** @attribute InAttribute() */ /** @attribute OptionalAttribute() */ int CommandStyleFlags, 
	/** @attribute InAttribute() */ /** @attribute OptionalAttribute() */ vsCommandControlType ControlType
)
JScript does not support passing value-type arguments by reference.

Parameters

AddInInstance

Required. The AddIn Object is adding the new command.

Name

Required. The short form of the name for your new command. AddNamedCommand2 uses the preface, Addins.Progid., to create a unique name.

ButtonText

Required. The name to use if the command is bound to a button that is displayed by name rather than by icon.

Tooltip

Required. The text displayed when a user hovers the mouse pointer over any control bound to the new command.

MSOButton

Required. Indicates whether the named command's button picture is an Office picture. True = button. If MSOButton is False, then Bitmap is the ID of a 16x16 bitmap resource (but not an icon resource) in a Visual C++ resource DLL that must reside in a folder with the language's locale identifier (1033 for English).

Bitmap

Optional. The ID of a bitmap to display on the button.

ContextUIGUIDs

Optional. A SafeArray of GUIDs that determines which environment contexts (that is, debug mode, design mode, and so on) enable the command. See DisableFlags.

vsCommandStatusValue

Optional. Determines whether the disabled state of the command is invisible or grey when you supply a ContextUIGUIDs and none are currently active.

CommandStyleFlags

Value from the vsCommandStyle enumeration. Controls the visual style of any UI added for this command.

ControlType

Defines the control type added when the UI is created.

Return Value

The named command that was created.
Show:
© 2015 Microsoft