Commands2::CommandInfo Method (Object^, String^, Int32)

 

Returns the command GUID and ID associated with the given CommandBar control.

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

void CommandInfo(
	Object^ CommandBarControl,
	[OutAttribute] String^% Guid,
	[OutAttribute] int% ID
)

Parameters

CommandBarControl
Type: System::Object^

Required. The CommandBar control associated with the command.

Guid
Type: System::String^

Required. The GUID of the command.

ID
Type: System::Int32

Required. The command ID.

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
Return to top
Show: