MENUITEMTEMPLATE

Menu-ItemTemplate

A complete menu template consists of a header and one or more menu-item lists. The following shows the structure of the menu-template header:

typedef struct {

WORD versionNumber;

WORD offset;

} MENUITEMTEMPLATEHEADER;

The menu-template header contains the following fields:

Field Description  
versionNumber Specifies the version number. Should be zero.  
offset Specifies the offset from the header in bytes where the menu-item list begins.  

One or more MENUITEMTEMPLATE structures are combined to form the menu-item list.

typedef struct {

WORD mtOption;

WORD mtID;

char mtString;

} MENUITEMTEMPLATE;

The MENUITEMTEMPLATE structure has the following fields:

Field Description  
mtOption Specifies a mask of one or more predefined menu options that specify the appearance of the menu item. The menu options are as follows:  
  Value Meaning
  MF_CHECKED Item has a checkmark next to it.
  MF_END Item must be specified for the last item in a pop-up menu or a static menu.
  MF_GRAYED Item is initially inactive and drawn with a gray effect.
  MF_HELP Item has a vertical separator to its left.
  MF_MENUBARBREAK Item is placed in a new column. The old and new columns are separated by a bar.
  MF_MENUBREAK Item is placed in a new column.
  MF_OWNERDRAW The owner of the menu is responsible for drawing all visual aspects of the menu item, includ-ing highlighted, checked and inactive states. This option is not valid for a top-level menu item.
  MF_POPUP Item displays a sublist of menu items when selected.
mtID Specifies an identification code for a nonpop-up menu item. The MENUITEMTEMPLATE data structure for a pop-up menu item does not contain the mtID field.  
mtString Sepcifies a null-terminated character string that contains the name of the menu item.  

See also

The LoadMenuIndirect function in Chapter 4, “Functions Directory.”