CMenu::LoadMenuIndirect

Syntax

BOOL LoadMenuIndirect( const BYTE FAR* lpMenuTemplate );

Parameters

lpMenuTemplate

Points to a menu template (which is a single MENUITEMTEMPLATEHEADER structure and a collection of one or more MENUITEMTEMPLATE structures).

The MENUITEMTEMPLATEHEADER structure has the following generic form:

typedef struct {

WORD versionNumber;

WORD offset;

} MENUITEMTEMPLATEHEADER;

The MENUITEMTEMPLATE structure has the following generic form:

typedef struct {

WORD mtOption;

WORD mtID;

char mtString;

} MENUITEMTEMPLATE[1];

Remarks

Loads a resource from a menu template in memory and attaches it to the CMenu object. A menu template is a header followed by a collection of one or more MENUITEMTEMPLATE structures, each of which may contain one or more menu items and pop-up menus.

The version number should be 0.

The mtOption flags should include MF_END for the last item in a pop-up list and for the last item in the main list. See AppendMenu for other flags. The mtId member must be omitted from the MENUITEMTEMPLATE structure when MF_POPUP is specified in mtOption.

The space allocated for the MENUITEMTEMPLATE structure must be large enough for mtString to contain the name of the menu item as a null-terminated string.

Return Value

TRUE if the menu resource was loaded successfully; otherwise FALSE.

See Also

CMenu::DestroyMenu, CMenu::LoadMenu, ::LoadMenuIndirect