MenuItemFromPoint function

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

Syntax

int MenuItemFromPoint(
  HWND  hWnd,
  HMENU hMenu,
  POINT ptScreen
);

Parameters

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.

hMenu

Type: HMENU

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

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

   
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