Share via


AppendMenu

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

This function appends a new item to the end of the specified menu. You can use AppendMenu to specify the content, appearance, and behavior of the menu item.

Syntax

BOOL AppendMenu(
  HMENU hMenu, 
  UINT uFlags, 
  UINT uIDNewItem, 
  LPCTSTR lpNewItem 
); 

Parameters

  • hMenu
    [in] Handle to the menu bar, drop-down menu, submenu, or shortcut menu to be changed.
  • uFlags
    [in] Specifies flags to control the appearance and behavior of the new menu item. This parameter must be a combination of the values listed in Menus Constants.

    If this parameter includes the MF_SEPARATOR constant, AppendMenu ignores the values of the lpNewItem and uIDNewItem parameters. If this parameter includes the MF_STRING constant, the lpNewItem parameter points to the string.

  • uIDNewItem
    [in] Either the identifier of the new menu item or, if the uFlags parameter is set to MF_POPUP, the handle to the drop-down menu or submenu.
  • lpNewItem
    [in] Long pointer to the content of the new menu item. If uFlags includes the MF_STRING constant, lpNewItem points to a null-terminated string (the default). If uFlags includes the MF_OWNERDRAW constant, lpNewItem points to a 32-bit value that can be used to maintain additional data related to the menu item.

Return Value

Nonzero indicates success. Zero indicates failure. To get extended error information, call GetLastError.

Remarks

The application must call the DrawMenuBar function when a menu changes, whether or not the menu is in a displayed window.

To get keyboard accelerators to work with bitmap or owner-drawn menu items, the owner of the menu must process the WM_MENUCHAR message.

Windows CE 1.0 does not support cascading menus. If you are using Windows CE 1.0, you cannot insert an MF_POPUP menu into another pop-up menu. In Windows CE 2.0 and later, cascading menus are supported.

Requirements

Header winuser.h
Windows Embedded CE Windows CE 1.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also

Reference

CreateMenu
DeleteMenu
DestroyMenu
InsertMenu
RemoveMenu
WM_DRAWITEM
WM_MEASUREITEM
WM_MENUCHAR
Menus Functions
Menus Constants