SetMenuDefaultItem function (winuser.h)

Sets the default menu item for the specified menu.

Syntax

BOOL SetMenuDefaultItem(
  [in] HMENU hMenu,
  [in] UINT  uItem,
  [in] UINT  fByPos
);

Parameters

[in] hMenu

Type: HMENU

A handle to the menu to set the default item for.

[in] uItem

Type: UINT

The identifier or position of the new default menu item or -1 for no default item. The meaning of this parameter depends on the value of fByPos.

[in] fByPos

Type: UINT

The meaning of uItem. If this parameter is FALSE, uItem is a menu item identifier. Otherwise, it is a menu item position. See About Menus for more information.

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.

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-menu-l1-1-2 (introduced in Windows 10, version 10.0.10240)

See also

Conceptual

GetMenuDefaultItem

Menus

Reference