Commands2.CommandInfo(Object, String, Int32) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
返回与给定控件关联的命令 GUID 和 ID CommandBar 。
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)
参数
- CommandBarControl
- Object
必需。 CommandBar与命令关联的控件。
- Guid
- String
必需。 命令的 GUID。
- ID
- Int32
必需。 命令 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