Click to Rate and Give Feedback
MSDN
MSDN Library
User Interface
Resources
Menus
Menu Reference
Functions
 GetMenuItemRect Function
GetMenuItemRect Function

The GetMenuItemRect function retrieves the bounding rectangle for the specified menu item.

Syntax

BOOL GetMenuItemRect(      
    HWND hWnd,     HMENU hMenu,     UINT uItem,     LPRECT lprcItem );

Parameters

hWnd
[in] Handle to the window containing the menu.

Windows 98/Me and Windows 2000/XP: If this value is NULL and the hMenu parameter represents a popup menu, the function will find the menu window.

hMenu
[in] Handle to a menu.
uItem
[in] Zero-based position of the menu item.
lprcItem
[out] Pointer to a RECT structure that receives the bounding rectangle of the specified menu item expressed in screen coordinates.

Return Value

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.

Function Information

Minimum DLL Versionuser32.dll
HeaderDeclared in Winuser.h, include Windows.h
Import libraryUser32.lib
Minimum operating systems Windows 95, Windows NT 4.0

See Also

Menus
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker