Menu Modifications
Several functions enable you to change a menu after it has been loaded or
created. These changes may include adding or removing menu items and modifying
existing menu items.
To add a menu item, use the
InsertMenuItem function. You can use the
SetMenuItemInfo function to change the attributes of an existing menu item. The
lpmii parameter points to a
MENUITEMINFO structure, which contains the new attributes and specifies which attributes
to change. A menu item's attributes include its type, state, identifier,
submenu, bitmaps, item data, and text.
The older
AppendMenu and
InsertMenu functions can also be used to add menu items, but new applications should use
InsertMenuItem. The
AppendMenu function appends a menu item to the end of a menu or submenu; the
InsertMenu function inserts a menu item at a specified position in a menu or submenu.
Both functions permit the attributes of the menu item to be specified, including
whether the menu item is enabled, disabled, grayed, checked, or unchecked.
To change the appearance or attributes of an existing menu item, use the
ModifyMenu function. For example, the text string or bitmap of a menu item can be
enabled, disabled, grayed, checked, or unchecked. The
ModifyMenu function replaces the specified menu item with a new item.
To retrieve information about a menu item, use the
GetMenuItemInfo function. The
lpmii parameter points to a
MENUITEMINFO structure, which specifies the attributes to retrieve and receives their
current values.
To delete a menu item from a menu, use the
DeleteMenu or
RemoveMenu function. If the item being deleted is one that opens a submenu,
DeleteMenu deletes the associated submenu, discarding the menu handle and freeing the
memory used by the submenu. The
RemoveMenu function deletes a menu item, but if the item opens a submenu, the function
does not destroy the submenu or its handle, allowing the submenu to be reused.
To redraw the menu bar after a menu bar has been modified, use the
DrawMenuBar function. Otherwise, the modifications will not appear until Windows redraws
the owner window.
- Software for developers
-
Delphi Components
.Net Components
Software for Android Developers
- More information resources
-
MegaDetailed.Net
Unix Manual Pages
Delphi Examples
- Databases for Amazon shops developers
-
Amazon Categories Database
Browse Nodes Database