Commands2.CommandInfo 方法 (Object, String%, Int32%)
返回与给定 CommandBar 控件关联的命令 GUID 和 ID。
命名空间: EnvDTE80
程序集: EnvDTE80(在 EnvDTE80.dll 中)
语法
声明
Sub CommandInfo ( _
CommandBarControl As Object, _
<OutAttribute> ByRef Guid As String, _
<OutAttribute> ByRef ID As Integer _
)
void CommandInfo(
Object CommandBarControl,
out string Guid,
out int ID
)
void CommandInfo(
[InAttribute] Object^ CommandBarControl,
[OutAttribute] String^% Guid,
[OutAttribute] int% ID
)
abstract CommandInfo :
CommandBarControl:Object *
Guid:string byref *
ID:int byref -> unit
function CommandInfo(
CommandBarControl : Object,
Guid : String,
ID : int
)
参数
- CommandBarControl
类型:System.Object
必选。与该命令关联的 CommandBar 控件。
- Guid
类型:System.String%
必选。命令的 GUID。
- ID
类型:System.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
.NET Framework 安全性
- 对直接调用方的完全信任。此成员不能由部分信任的代码使用。有关更多信息,请参见通过部分受信任的代码使用库。