Important: |
---|
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist. |
This function inserts a new menu item into a menu, moving other items down the menu.
BOOL InsertMenu( HMENU hMenu , UINT uPosition , UINT uFlags , UINT uIDNewItem , LPCTSTR lpNewItem );
Parameters
Value | Description |
---|---|
MF_BYCOMMAND | Indicates that the uPositionparameter gives the identifier of the menu item. The MF_BYCOMMAND flag is the default if neither the MF_BYCOMMAND nor MF_BYPOSITION flag is specified. |
MF_BYPOSITION | Indicates that the uPositionparameter gives the zero-based relative position of the new menu item. If uPositionis 0xFFFFFFFF, the new menu item is appended to the end of the menu. |
Value | Description |
---|---|
MF_OWNERDRAW | Contains a 32-bit value supplied by the application that can be used to maintain additional data related to the menu item. The value is in the itemDatamember of the structure pointed to by the lparamparameter of the WM_MEASUREITEMor WM_DRAWITEMmessage sent when the menu item is created or its appearance is updated. |
MF_STRING | Contains a pointer to a null-terminated string (the default). |
Return Values
Nonzero indicates success. Zero indicates failure. To get extended error information, call GetLastError.
Remarks
The application must call the DrawMenuBarfunction whenever a menu changes, whether or not the menu is in a displayed window.
The following list describes the flags that can be set in the uFlagsparameter:
Windows CE versions 1.0 and 1.01 do not support this flag.
Windows CE versions 1.0 and 1.01 do not support this flag.
Windows CE versions 1.0 and 1.01 do not support this flag.
The following groups of flags cannot be used together:
Menu items cannot be disabled without being grayed. To disable a menu item, use the MF_GRAYED flag.
Windows CE versions 1.0 and 1.01 do not support cascading menus. If you are using Windows CE version 1.0 or 1.01, you cannot insert an MF_POPUP menu into another pop-up menu. If using Windows CE versions 2.0 or later, you can.
Requirements
Runs on | Versions | Defined in | Include | Link to |
---|---|---|---|---|
Windows CE OS | 1.0 and later | Winuser.h | Menu.lib |
Note This API is part of the complete Windows CE OS package as provided by Microsoft. The functionality of a particular platform is determined by the original equipment manufacturer (OEM) and some devices may not support this API.
See Also
AppendMenu, CreateMenu, DeleteMenu, GetLastError, RemoveMenu, WM_DRAWITEM, WM_MEASUREITEM