This documentation is archived and is not being maintained.

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.



Required. The AddIn Object is adding the new command.


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


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


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


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


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


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


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


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


Defines the control type added when the UI is created.

Return Value

The named command that was created.