IOleInPlaceComponent.GetCntrContextMenu Method
Allows an in-place VSPackage object assuming the role of main component to override the context menu requested by an object assuming the subcomponent or component control role.
Namespace: Microsoft.VisualStudio.Shell.Interop
Assembly: Microsoft.VisualStudio.Shell.Interop (in Microsoft.VisualStudio.Shell.Interop.dll)
Syntax
'Declaration
Function GetCntrContextMenu ( _
dwRoleActiveObj As UInteger, _
ByRef rclsidActiveObj As Guid, _
nMenuIdActiveObj As Integer, _
pos As POINTS(), _
<OutAttribute> ByRef pclsidCntr As Guid, _
<OutAttribute> menuid As OLEMENUID(), _
<OutAttribute> ByRef pgrf As UInteger _
) As Integer
int GetCntrContextMenu(
uint dwRoleActiveObj,
ref Guid rclsidActiveObj,
int nMenuIdActiveObj,
POINTS[] pos,
out Guid pclsidCntr,
OLEMENUID[] menuid,
out uint pgrf
)
int GetCntrContextMenu(
[InAttribute] unsigned int dwRoleActiveObj,
[InAttribute] Guid% rclsidActiveObj,
[InAttribute] int nMenuIdActiveObj,
[InAttribute] array<POINTS>^ pos,
[OutAttribute] Guid% pclsidCntr,
[OutAttribute] array<OLEMENUID>^ menuid,
[OutAttribute] unsigned int% pgrf
)
abstract GetCntrContextMenu :
dwRoleActiveObj:uint32 *
rclsidActiveObj:Guid byref *
nMenuIdActiveObj:int *
pos:POINTS[] *
pclsidCntr:Guid byref *
menuid:OLEMENUID[] byref *
pgrf:uint32 byref -> int
function GetCntrContextMenu(
dwRoleActiveObj : uint,
rclsidActiveObj : Guid,
nMenuIdActiveObj : int,
pos : POINTS[],
pclsidCntr : Guid,
menuid : OLEMENUID[],
pgrf : uint
) : int
Parameters
dwRoleActiveObj
Type: System.UInt32[in] Specifies the role of the innermost UI active object that contributes the context menu. For a list of valid dwRoleActiveObj values, see OLEROLE.
rclsidActiveObj
Type: System.Guid%[in] Class identifier (CLSID) of the innermost UI active object that contributes the context menu.
nMenuIdActiveObj
Type: System.Int32[in] Identifier of the menu to be contributed. A menu identifier is a combination of a CLSID and an OLEMENUID structure.
pos
Type: array<Microsoft.VisualStudio.Shell.Interop.POINTS[][in] Position in screen coordinates for the context menu.
pclsidCntr
Type: System.Guid%[out] Class identifier (CLSID) of the context menu to be contributed. If there is no menu to contribute, this parameter should be nulla null reference (Nothing in Visual Basic).
menuid
Type: array<Microsoft.VisualStudio.Shell.Interop.OLEMENUID[][out] Identifier of the context menu to be contributed. The identifier is an OLEMENUID structure made up of a numeric menu identifier, a character buffer to hold the menu name, and a pointer to the menu. The menu may be specified either with a menu name string or with the ID of a built-in menu of the in-place object assuming the role of main component. The string should be a name of a menu that is known to the environment. If the string does not identify a valid menu name, then no context menu will be displayed. The environment can return a list of valid menu names through the IPerPropertyBrowsing method.
pgrf
Type: System.UInt32%[out] Flags controlling how the menu should be used. For a list of valid pgrf values, see OLEMENU.
Return Value
Type: System.Int32
If the method succeeds, it returns S_OK. If it fails, it returns an error code.
Remarks
COM Signature
From oleipc.idl:
HRESULT IOleInPlaceComponent::GetCntrContextMenu(
[in] DWORD dwRoleActiveObj,
[in] REFCLSID rclsidActiveObj,
[in] LONG nMenuIdActiveObj,
[in] REFPOINTS pos,
[out] CLSID *pclsidCntr,
[out] OLEMENUID *menuid,
[out] DWORD *pgrf
);
The menuid parameter can only be set to OLEMENU_CNTRMENUONLY; the OLEMENU_MENUMERGE value is not supported.
In-place objects can request the display of a context menu by calling ShowContextMenu. If the caller of ShowContextMenu is an object assuming the role of subcomponent or component control, the environment calls GetCntrContextMenu of the main component in-place object. This call allows the main component in-place object to gain control of the final context menu display. The main component can perform one of the following actions in its implementation of GetCntrContextMenu:
Allow the inner object's context menu to be displayed.
Not allow any context menu to be displayed.
Contribute a container context menu that completely overrides that of the inner object.
Contribute a container context menu that is merged with that of the inner object. The container's menu needs to include a special marker at the point where the object's menu is inserted.
If the in-place object sets the OLEMENU_MENUMERGE bit in the pgrf parameter, the container and active object menus will be merged. If the OLEMENU_MENUMERGE bit is not on, the container menu overrides the menu of the active object. That is, the container context menu is displayed without merging the menu of the active object.
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.