IVsObjectList2.GetContextMenu(UInt32, Guid, Int32, IOleCommandTarget) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
允许列表为给定列表项提供不同的上下文菜单和 IOleCommandTarget。
public:
int GetContextMenu(System::UInt32 index, [Runtime::InteropServices::Out] Guid % pclsidActive, [Runtime::InteropServices::Out] int % pnMenuId, [Runtime::InteropServices::Out] Microsoft::VisualStudio::OLE::Interop::IOleCommandTarget ^ % ppCmdTrgtActive);
public int GetContextMenu (uint index, out Guid pclsidActive, out int pnMenuId, out Microsoft.VisualStudio.OLE.Interop.IOleCommandTarget ppCmdTrgtActive);
abstract member GetContextMenu : uint32 * Guid * int * IOleCommandTarget -> int
Public Function GetContextMenu (index As UInteger, ByRef pclsidActive As Guid, ByRef pnMenuId As Integer, ByRef ppCmdTrgtActive As IOleCommandTarget) As Integer
参数
- index
- UInt32
中指定感兴趣的列表项的索引。
- pclsidActive
- Guid
弄指定包含菜单的菜单组的 CLSID。
- pnMenuId
- Int32
弄指向包含菜单 id 的整数的指针。
- ppCmdTrgtActive
- IOleCommandTarget
弄指向列表的或库的接口的指针 IOleCommandTarget 。
返回
如果该方法成功,则它会返回 S_OK。 如果该方法失败,则会返回错误代码。
注解
COM 签名
从 vsshell80:
[C++]
HRESULT IVsObjectList2::GetContextMenu(
[in] ULONG Index,
[out] CLSID *pclsidActive,
[out] LONG *pnMenuId,
ut] IOleCommandTarget **ppCmdTrgtActive
);
此方法仅适用于 ClassView 工具。 选择列表项后,可以使用此方法来指定备用上下文菜单和 IOleCommandTarget 来处理菜单上的命令。 这会 IOleCommandTarget 在处理命令时获得优先优先级。
备注
如果在 ClassView 中选择了多个项,则不会使用此备用上下文菜单。