GetMenuBarInfo function (winuser.h)

Retrieves information about the specified menu bar.

Syntax

BOOL GetMenuBarInfo(
  [in]      HWND         hwnd,
  [in]      LONG         idObject,
  [in]      LONG         idItem,
  [in, out] PMENUBARINFO pmbi
);

Parameters

[in] hwnd

Type: HWND

A handle to the window (menu bar) whose information is to be retrieved.

[in] idObject

Type: LONG

The menu object. This parameter can be one of the following values.

Value Meaning
OBJID_CLIENT
((LONG)0xFFFFFFFC)
The popup menu associated with the window.
OBJID_MENU
((LONG)0xFFFFFFFD)
The menu bar associated with the window (see the GetMenu function).
OBJID_SYSMENU
((LONG)0xFFFFFFFF)
The system menu associated with the window (see the GetSystemMenu function).

[in] idItem

Type: LONG

The item for which to retrieve information. If this parameter is zero, the function retrieves information about the menu itself. If this parameter is 1, the function retrieves information about the first item on the menu, and so on.

[in, out] pmbi

Type: PMENUBARINFO

A pointer to a MENUBARINFO structure that receives the information. Note that you must set the cbSize member to sizeof(MENUBARINFO) before calling this function.

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, call GetLastError.

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
API set ext-ms-win-ntuser-misc-l1-5-0 (introduced in Windows 10, version 10.0.10240)

See also

Conceptual

GetMenu

GetSystemMenu

MENUBARINFO

Menus

Reference