共用方式為


IVsUIShell.ShowContextMenu Method

Definition

Shows the context menu for the active menu object.

public:
 int ShowContextMenu(System::UInt32 dwCompRole, Guid % rclsidActive, int nMenuId, cli::array <Microsoft::VisualStudio::Shell::Interop::POINTS> ^ pos, Microsoft::VisualStudio::OLE::Interop::IOleCommandTarget ^ pCmdTrgtActive);
public int ShowContextMenu (uint dwCompRole, ref Guid rclsidActive, int nMenuId, Microsoft.VisualStudio.Shell.Interop.POINTS[] pos, Microsoft.VisualStudio.OLE.Interop.IOleCommandTarget pCmdTrgtActive);
abstract member ShowContextMenu : uint32 * Guid * int * Microsoft.VisualStudio.Shell.Interop.POINTS[] * Microsoft.VisualStudio.OLE.Interop.IOleCommandTarget -> int
Public Function ShowContextMenu (dwCompRole As UInteger, ByRef rclsidActive As Guid, nMenuId As Integer, pos As POINTS(), pCmdTrgtActive As IOleCommandTarget) As Integer

Parameters

dwCompRole
UInt32

[in] Do not use.

rclsidActive
Guid

[in] Specifies the GUID of the context menu in the .ctc file.

nMenuId
Int32

[in] Identifier of the context menu to show from the .ctc file.

pos
POINTS[]

[in] Specifies the position to place the context menu.

pCmdTrgtActive
IOleCommandTarget

[in] Pointer to the IOleCommandTarget interface of the active menu object. Can be null.

Returns

If the method succeeds, it returns S_OK. If it fails, it returns an error code.

Remarks

COM Signature

From vsshell.idl:

HRESULT IVsUIShell::ShowContextMenu(  
   [in] DWORD dwCompRole,  
   [in] REFCLSID rclsidActive,  
   [in] LONG nMenuId,  
   [in] REFPOINTS pos,  
   [in] IOleCommandTarget *pCmdTrgtActive  
);  

All commands are routed first to the IOleCommandTarget passed in pCmdTrgtActive.

Applies to