HiliteMenuItem function (winuser.h)

Adds or removes highlighting from an item in a menu bar.

Syntax

BOOL HiliteMenuItem(
  [in] HWND  hWnd,
  [in] HMENU hMenu,
  [in] UINT  uIDHiliteItem,
  [in] UINT  uHilite
);

Parameters

[in] hWnd

Type: HWND

A handle to the window that contains the menu.

[in] hMenu

Type: HMENU

A handle to the menu bar that contains the item.

[in] uIDHiliteItem

Type: UINT

The menu item. This parameter is either the identifier of the menu item or the offset of the menu item in the menu bar, depending on the value of the uHilite parameter.

[in] uHilite

Type: UINT

Controls the interpretation of the uItemHilite parameter and indicates whether the menu item is highlighted. This parameter must be a combination of either MF_BYCOMMAND or MF_BYPOSITION and MF_HILITE or MF_UNHILITE.

Value Meaning
MF_BYCOMMAND
0x00000000L
Indicates that uItemHilite gives the identifier of the menu item.
MF_BYPOSITION
0x00000400L
Indicates that uItemHilite gives the zero-based relative position of the menu item.
MF_HILITE
0x00000080L
Highlights the menu item. If this flag is not specified, the highlighting is removed from the item.
MF_UNHILITE
0x00000000L
Removes highlighting from the menu item.

Return value

Type: BOOL

If the menu item is set to the specified highlight state, the return value is nonzero.

If the menu item is not set to the specified highlight state, the return value is zero.

Remarks

The MF_HILITE and MF_UNHILITE flags can be used only with the HiliteMenuItem function; they cannot be used with the ModifyMenu function.

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

Conceptual

Menus

ModifyMenu

Reference