CMenu::SetDefaultItem

Sets the default menu item for the specified menu.

BOOL SetDefaultItem( 
   UINT uItem, 
   BOOL fByPos = FALSE  
);

Parameters

  • uItem
    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.

  • fByPos
    Value specifying the meaning of uItem. If this parameter is FALSE, uItem is a menu item identifier. Otherwise, it is a menu item position.

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 Win32 function GetLastError, as described in the Windows SDK.

Remarks

This member function implements the behavior of the Win32 function SetMenuDefaultItem, as described in the Windows SDK.

Example

See the example for CMenu::InsertMenu.

Requirements

Header: afxwin.h

See Also

Reference

CMenu Class

Hierarchy Chart

CMenu::GetDefaultItem