Help Center

MenuContextfunction

Creates a floating context menu.

Windowsfunctiondocumented

Syntax

FUNCTION MenuContext (BYVAL hWin AS HWND, BYVAL hPopupMenu AS HMENU, BYVAL x AS LONG, BYVAL y AS LONG, BYVAL flags AS UINT) AS LONG

Parameters

NameDescription
hMenuA handle to the window or dialog that owns the shortcut menu.
hPopupMenuA handle to the shortcut menu to be displayed. The handle can be obtained by calling MenuAddPopup to create a new shortcut menu, or by calling MenuGetSubMenu to retrieve a handle to a submenu associated with an existing menu item.
xThe horizontal location of the shortcut menu, in screen coordinates.
yThe vertical location of the shortcut menu, in screen coordinates.
flagsMay be combined, as appropriate, to specify the characteristics of the context menu.
TPM_LEFTBUTTON: Tracks the left button.
TPM_RIGHTBUTTON: Tracks the right button.
TPM_LEFTALIGN: Left side of the menu is aligned with x.
TPM_CENTERALIGN: Centers horizontally with x.
TPM_RIGHTALIGN: Right side of the menu is aligned with x.
TPM_TOPALIGN: Top of the menu is aligned with y.
TPM_VCENTERALIGN: Centers vertically with y.
TPM_BOTTOMALIGN: Bottom of the menu is aligned with y.

Return value

If you specify TPM_RETURNCMD in the flags parameter, the return value is the menu-item identifier of the item that the user selected. If the user cancels the menu without making a selection, or if an error occurs, the return value is zero.

Description

Creates a floating context menu.

Reference

  • Defined in AfxNova/AfxMenu.inc:1735
  • Documented in Windows/Windows GUI/Menu Procedures.md
  • Topic: About Menus