IContextMenuProvider::ShowContextMenu
[This is preliminary documentation and subject to change.]
Displays a context menu.
HRESULT ShowContextMenu(
HWND hwndParent, // Handle of the menu's parent window
long xPos, // Horizontal location of the menu
long yPos, // Vertical location of the menu
long * plSelected // Identifier of the selected menu item
);
Parameters
-
hwndParent
-
[in] Handle of the parent window in which the context menu will be displayed.
-
xPos
-
[in] Specifies the horizontal location of the upper-left corner of the context menu in screen coordinates.
-
yPos
-
[in] Specifies the vertical location of the upper-left corner of the context menu in screen coordinates.
-
plSelected
-
[out, retval] Specifies the ICommandID value (as passed to IContextMenuCallback::AddItem) of the selected menu item. If this is zero, either none of the context menu items were selected or the selected context menu item was added by an extension. If an extension item was selected, ShowContextMenu notifies the extension by calling IExtendContextMenu::Command.
Return Values
-
S_OK
-
The context menu was successfully displayed.
-
E_UNEXPECTED
-
An unexpected error occurred.
Remarks
ShowContextMenu automatically clears the context menu after displaying it. Nevertheless, it is a good practice to call IContextMenuProvider::EmptyMenuList before beginning to build a context menu.
See Also
IContextMenuProvider