GetMenuItemRect function (winuser.h)

Retrieves the bounding rectangle for the specified menu item.

Syntax

BOOL GetMenuItemRect(
  [in, optional] HWND   hWnd,
  [in]           HMENU  hMenu,
  [in]           UINT   uItem,
  [out]          LPRECT lprcItem
);

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 a menu.

[in] uItem

Type: UINT

The zero-based position of the menu item.

[out] lprcItem

Type: LPRECT

A pointer to a RECT structure that receives the bounding rectangle of the specified menu item expressed in screen coordinates.

Return value

Type: BOOL

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, use the GetLastError function.

Remarks

In order for the returned rectangle to be meaningful, the menu must be popped up if a popup menu or attached to a window if a menu bar. Menu item positions are not determined until the menu is displayed.

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