Commands2.CommandInfo(Object, String, Int32) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Returns the command GUID and ID associated with the given CommandBar control.
public:
void CommandInfo(System::Object ^ CommandBarControl, [Runtime::InteropServices::Out] System::String ^ % Guid, [Runtime::InteropServices::Out] int % ID);
void CommandInfo(winrt::Windows::Foundation::IInspectable const & CommandBarControl, [Runtime::InteropServices::Out] std::wstring const & & Guid, [Runtime::InteropServices::Out] int & ID);
[System.Runtime.InteropServices.DispId(5)]
public void CommandInfo (object CommandBarControl, out string Guid, out int ID);
[<System.Runtime.InteropServices.DispId(5)>]
abstract member CommandInfo : obj * string * int -> unit
Public Sub CommandInfo (CommandBarControl As Object, ByRef Guid As String, ByRef ID As Integer)
Parameters
- CommandBarControl
- Object
Required. The CommandBar control associated with the command.
- Guid
- String
Required. The GUID of the command.
- ID
- Int32
Required. The command ID.
Implements
- Attributes
Examples
Sub CommandInfoExample()
Dim cmds As Commands
Dim cmdobj As Command
Dim cmdbarobj As CommandBar
Dim cmdbarctl As CommandBarControl
Dim colAddins As AddIns
Dim GUID As String
Dim ID As Long
' Set references.
colAddins = DTE.AddIns()
cmds = DTE.Commands
cmdobj = cmds.Item("File.NewFile")
GUID = ""
ID = 0
' Create a toolbar and add the File.NewFile command to it.
cmdbarobj = cmds.AddCommandBar("AACmdBar", vsCommandBarType.vsCommandBarTypeToolbar)
MsgBox("Commandbar name: " & cmdbarobj.Name)
cmdbarctl = cmdobj.AddControl(cmdbarobj)
' Assign new GUID and ID to command bar control.
cmds.CommandInfo(cmdbarctl, GUID, ID)
End Sub