Jump to content

MM INSERTITEM

From EDM2

This message inserts a menu item into a menu.

Syntax

param1
PMENUITEM pmenuitem;   /* Menu-item data structure. */

param2
PSZ pszItemText;     /* Item text. */

Parameters

pmenuitem (PMENUITEM) - input
Menu-item data structure. This points to a MENUITEM structure.
pszItemText (PSZ) - input
Item text. This points to a string containing the text to be inserted.

Returns

sIndexInserted (SHORT) - return
Index of inserted item.
MIT_MEMERROR: The menu control cannot allocate space to insert the menu item in the menu.
MIT_ERROR: An error other than MIT_MEMERROR occurred.
Other: The zero-based index of the offset of the item within the menu.

Remarks=

The menu control window procedure responds to this message by inserting the identified item into the menu at the position indicated by the specified MENUITEM data structure (contained within the menu-item structure). If the position is MIT_END, the item is added to the end of the menu. If the style of the item includes MIS_TEXT, the text of the item is specified by pszItemText.

The menu control window procedure sets sIndexInserted to the zero-based index of the position of the item within the menu.

Note
It must be sent, not posted, to the menu control.

Default Processing

The default window procedure does not expect to receive this message and therefore takes no action on it, other than to set sIndexInserted to the default value of 0.