Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

Commands.CommandInfo Method

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

Namespace:  EnvDTE
Assembly:  EnvDTE (in EnvDTE.dll)
abstract CommandInfo : 
        CommandBarControl:Object * 
        Guid:string byref * 
        ID:int byref -> unit


Type: System.Object

Required. The Microsoft.VisualStudio.CommandBars.CommandBar control associated with the command.

Type: System.String

Required. The command's GUID.

Type: System.Int32

Required. The command's ID.

' Macro code.
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", _
   MsgBox("Commandbar name: " & cmdbarobj.Name)
   cmdbarctl = cmdobj.AddControl(cmdbarobj)
   ' Assign new GUID and ID to the command bar control.
   cmds.CommandInfo(cmdbarctl, GUID, ID)
End Sub
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
© 2014 Microsoft. All rights reserved.