Syntax:
MENUITEM text, menu-id[, menuitem-style] [, menuitem-attribute]
The MENUITEM statement creates a menu item for a menu. The statement, permitted only in a MENU or SUBMENU statement, defines the text, identifier, and attributes of a menu item. The system displays the text when it displays the corresponding menu. If the user chooses the menu item, the system generates a WM_COMMAND message that includes the specified menu-item identifier and sends it to the window owning the menu.
MENUITEM SEPARATOR
The alternative form of the MENUITEM statement, MENUITEM SEPARATOR, creates a menu separator. A menu separator is a horizontal dividing bar between two menu items in a submenu. The separator is not active - that is, the user cannot choose it, it has no text associated with it, and it has no identifier.
text
If the menuitem-style field is MIS_BITMAP, item-name must be a bit-map identifier instead of a name. The bit-map identifier must have been previously defined using a BITMAP statement, must be preceded by the \b character, and must be enclosed in double quotation marks.
Duplicate menu-item identifiers are allowed, but menu items with non-unique identifiers cannot receive messages.
Character strings cannot be used as resource identifiers for this statement.
MIS_BITMAP
MIA_CHECKED
Comments
You can use the \t or \a character combination in any item name. The \t character inserts a tab when the name is displayed and is typically used to separate the menu-item name from the name of an accelerator key. The \a character aligns to the right all text that follows it. These characters are intended to be used for menu items in submenus only. The width of the displayed submenu is always adjusted so that there is at least one space (and usually more) between any pieces of text separated by a \t or a \a. (When compiling the menu resource, the compiler stores the \t and \a characters as control characters. For example, the \t is stored as 0x09.)
A tilde ( ~ ) character in the item name indicates that the following character is used as a mnemonic character for the item. When the menu is displayed, the tilde is not shown, but the mnemonic character is underlined. The user can choose the menu item by pressing the key corresponding to the underlined mnemonic character.
Example
This example creates a menu item named Alpha. The item identifier is 101.
MENUITEM "Alpha", 101
This example creates a menu item named Beta. The item identifier is 102. The menu item has a text style and a checked attribute.
MENUITEM "Beta", 102, MIS_TEXT, MIA_CHECKED
This example creates a menu separator between menu items named Gamma and Delta.
MENUITEM "Gamma", 103 MENUITEM SEPARATOR MENUITEM "Delta", 104
This example creates a menu item that has a bit map instead of a name. The bit-map identifier, 1, is first defined using a BITMAP statement. The identifier for the menu item is 301. Note that a sign must be placed in front of the bit map identifier in the MENUITEM statement.
BITMAP 1 mybitmap.bmp MENUITEM "#1", 301, MIS_BITMAP