InsertItem

Inserts a menu item at a given position on an existing menu. The menu can be one you create with the InsertMenu macro or a standard Windows Help menu.

Syntax

InsertItem("menu-id", "item-id", "item-name", "macro", position)

Parameter Description

menu-id Name used in the InsertMenu macro to create the menu or the name of a standard Windows Help menu. Standard menu names and identifiers are:

NameIdentifier

Filemnu_file

Editmnu_edit

Bookmarkmnu_bookmark

Helpmnu_helpon

The menu ID must be enclosed in quotation marks.

item-id Name that Windows Help uses internally to identify the menu item. The item ID must be enclosed in quotation marks.
item-name Name that Windows Help displays on the menu for the item. This name is case sensitive and must be enclosed in quotation marks. Within the quotation marks, place an ampersand (&) before the character you want to use for the item’s accelerator key.
macro Help macro or macro string that executes when the user chooses the menu item. The macro must be enclosed in quotation marks. Separate multiple macros in a string with semicolons (;).
position Number specifying the position in the menu where the new item will appear. The number must be an integer. Position 0 is the first or topmost position in the menu.

Example

The following macro inserts a menu item labeled Example as the fourth item on a View menu that has a “mnu_view” identifier:

InsertItem("mnu_view", "mnu_example", "E&xample", "JI(`charts.hlp', `eg_012_topic')", 3)

Choosing the menu item causes a jump to a topic with the “eg_012_topic” context string in the CHARTS.HLP file. Note that the letter x serves as the item’s accelerator key.

Comments

Be sure that the access key you assign to a menu item is unique. If you assign a key that conflicts with another menu accelerator key, Windows Help displays the “Unable to add item” error message and ignores the macro.

The item-id parameter defined in this macro can be used in other menu item macros to modify the menu item, such as disable it or change its macro function.

Windows Help ignores this macro if it is executed in a secondary window.

See Also

AppendItem, ChangeItemBinding, CheckItem, DeleteItem, DisableItem, EnableItem, InsertMenu, UncheckItem