MenuItemFromPoint function (winuser.h)

Determines which menu item, if any, is at the specified location.

Syntax

int MenuItemFromPoint(
  [in, optional] HWND  hWnd,
  [in]           HMENU hMenu,
  [in]           POINT ptScreen
);

Parameters

[in, optional] hWnd

Type: HWND

A handle to the window containing the menu. If this value is NULL and the hMenu parameter represents a popup menu, the function will find the menu window.

[in] hMenu

Type: HMENU

A handle to the menu containing the menu items to hit test.

[in] ptScreen

Type: POINT

A structure that specifies the location to test. If hMenu specifies a menu bar, this parameter is in window coordinates. Otherwise, it is in client coordinates.

Return value

Type: int

Returns the zero-based position of the menu item at the specified location or -1 if no menu item is at the specified location.

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header winuser.h (include Windows.h)
Library User32.lib
DLL User32.dll

See also

Menus