IContextMenuProvider::ShowContextMenu method (mmc.h)

The IContextMenuProvider::ShowContextMenu method displays a context menu.

Syntax

HRESULT ShowContextMenu(
  [in]  HWND hwndParent,
  [in]  long xPos,
  [in]  long yPos,
  [out] long *plSelected
);

Parameters

[in] hwndParent

A handle to the parent window in which the context menu is displayed.

[in] xPos

A value, in screen coordinates, that specifies the horizontal location of the upper-left corner of the context menu, in screen coordinates.

[in] yPos

A value, in screen coordinates, that specifies the vertical location of the upper-left corner of the context menu.

[out] plSelected

A value that 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 value

This method can return one of these values.

Remarks

ShowContextMenu automatically clears the context menu after that displays it. A best practice is to call IContextMenuProvider::EmptyMenuList before beginning to build a context menu.

Requirements

Requirement Value
Minimum supported client Windows Vista
Minimum supported server Windows Server 2008
Target Platform Windows
Header mmc.h
DLL Mmcndmgr.dll

See also

IContextMenuProvider