Commands.CommandInfo(Object, String, Int32) Method

Definition

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

[System.Runtime.InteropServices.DispId(5)]
public void CommandInfo (object CommandBarControl, out string Guid, out int ID);
Parameters
CommandBarControl
Object

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

Guid
String

Required. The command's GUID.

ID
Int32

Required. The command's ID.

Examples

Sub CommandInfoExample()  
   Dim cmds As Commands  
   Dim cmdobj As Command  
   Dim cmdbarobj As CommandBar  
   Dim cmdbarctl As CommandBarControl  
   Dim GUID As String  
   Dim ID As Long  

   ' Set references.  
   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 the command bar control.  
   cmds.CommandInfo(cmdbarctl, GUID, ID)  
End Sub  

Applies to