执行命令在 UI 层次结构 " 窗口中的特定项,或者在层次结构。
命名空间: Microsoft.VisualStudio.Shell.Flavor
程序集: Microsoft.VisualStudio.Shell.11.0(在 Microsoft.VisualStudio.Shell.11.0.dll 中)
语法
声明
Protected Overridable Function ExecCommand ( _
itemid As UInteger, _
ByRef pguidCmdGroup As Guid, _
nCmdID As UInteger, _
nCmdexecopt As UInteger, _
pvaIn As IntPtr, _
pvaOut As IntPtr _
) As Integer
protected virtual int ExecCommand(
uint itemid,
ref Guid pguidCmdGroup,
uint nCmdID,
uint nCmdexecopt,
IntPtr pvaIn,
IntPtr pvaOut
)
参数
- itemid
类型:System.UInt32
命令影响的项的标识符。对于单选,此值是实际项 ID对于多重选择,设置 itemid 等于 [F:Microsoft.VisualStudio.VSConstants.][VSITEMID_SELECTION]。
- pguidCmdGroup
类型:System.Guid%
命令组的唯一标识符。在 nCmdID的所有命令必须属于 pguidCmdGroup指定的组。
- nCmdID
类型:System.UInt32
要执行的命令。此命令必须属于组指定与 pguidCmdGroup。
- nCmdexecopt
类型:System.UInt32
OLECMDEXECOPT 枚举的成员,描述操作的类型执行。
- pvaIn
类型:System.IntPtr
对包含输入参数的 VARIANTARG 结构的指针。可以为 nullnull 引用(在 Visual Basic 中为 Nothing)。
- pvaOut
类型:System.IntPtr
用于接收命令输出的 VARIANTARG 结构的指针。可以为 nullnull 引用(在 Visual Basic 中为 Nothing)。
返回值
类型:System.Int32
如果方法成功,则返回 [F:Microsoft.VisualStudio.VSConstants.][S_OK]。如果失败,它会返回一个错误代码。
备注
此方法调用内层项目的 [T:Microsoft.VisualStudio.Shell.Interop.IVsUIHierarchyM:Microsoft.VisualStudio.Shell.Interop.IVsUIHierarchy.ExecCommand(System.UInt32,System.Guid@,System.UInt32,System.UInt32,System.IntPtr,System.IntPtr)] 。
.NET Framework 安全性
- 对直接调用方的完全信任。此成员不能由部分信任的代码使用。有关更多信息,请参见通过部分受信任的代码使用库。