DynMenuChange Function (ROM Call 0x3F0)

AMS 2.00 or higher menus.h

HANDLE DynMenuChange (HANDLE Handle, short ID, const void *NewData, unsigned short Flags);

Changes an entry in a dynamic menu.

DynMenuChange replaces an entry created with DynMenuAdd, MenuAddText, or MenuAddIcon in the dynamic toolbar menu associated with the handle Handle with a new entry (pointed to by NewData). Handle must be a handle created by MenuNew or MenuLoad. The new entry pointed by NewData can either be a text, an ICON structure, or a BITMAP structure, depending on the parameter Flags. ID is the identification number of the existing item you wish to change.

DynMenuChange returns H_NULL in case of an error, otherwise it returns Handle. An error occurs if the system runs out of memory or if there is an error in the parameters. If there is an error replacing the entry, the MF_ERROR flag in the menu structure is set (you can use MenuFlags to get this flag, but do not confuse menu structure flags such as MF_ERROR with the parameter Flags in DynMenuChange which gives the type of entry). DynMenuChange may cause heap compression.

The Flags parameter, defined in the enum DynMenuFlags, contains one of the flags given in the following array:

DMF_TEXT The parameter NewData points to a text string.
DMF_ICON The parameter NewData points to an ICON structure.
DMF_BITMAP The parameter NewData points to a BITMAP structure.


Uses: HeapRealloc, CalcBitmapSize, memcpy, memmove, strlen, strncpy, ROM Call 0x41E


See also: MenuNew, MenuLoad, DynMenuAdd