InsertMenu (Windows CE 5.0)

Send Feedback

This function inserts a new menu item into a menu, moving other items down the menu.

BOOLInsertMenu(HMENUhMenu, UINTuPosition, UINTuFlags, UINTuIDNewItem, LPCTSTRlpNewItem );


  • hMenu
    [in] Handle to the menu to be changed.

  • uPosition
    [in] The menu item before which the new menu item is to be inserted, as determined by the uFlags parameter. If uPosition is 0xFFFFFFFF, the new menu item is appended to the end of the menu.

  • uFlags
    [in] Constants that control the interpretation of the uPosition parameter and the content, appearance, and behavior of the new menu item. This parameter must be a combination of the required constant MF_BYCOMMAND or MF_BYPOSITION and at least one of the other constants listed in Menus Constants.

    If this parameter includes the MF_SEPARATOR constant, InsertMenu 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 has the MF_POPUP constant set, 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 Values

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


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

Windows CE 1.0 and 1.01 do not support cascading menus. If you are using Windows CE 1.0 or 1.01, you cannot insert an MF_POPUP menu into another pop-up menu. If using Windows CE 2.0 or later, you can.


OS Versions: Windows CE 1.0 and later.
Header: Winuser.h.
Link Library: Menu.lib.

See Also

AppendMenu | CreateMenu | DeleteMenu | RemoveMenu | WM_DRAWITEM | WM_MEASUREITEM | Menus Functions | Menus Constants

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.