The CreateMenus() function takes an array of NewMenus and creates a set of initialized and linked Intuition Menu, MenuItem, Image and IntuiText structures, that need only to be formatted before being used. Like the other tag-based functions, there is a CreateMenusA() call that takes a pointer to an array of TagItems and a CreateMenus() version that expects to find its tags on the stack. struct Menu *CreateMenusA( struct NewMenu *newmenu, struct TagItem *taglist ); struct Menu *CreateMenus( struct NewMenu *newmenu, Tag tag1, ... ); The first argument to these functions, newmenu, is a pointer to an array of NewMenu structures as described earlier. The tag arguments can be any of the following items: GTMN_FrontPen (ULONG) The pen number to use for menu text and separator bars. The default is zero. GTMN_FullMenu (BOOL) (New for V37, ignored under V36). This tag instructs CreateMenus() to fail if the supplied NewMenu structure does not describe a complete Menu structure. This is useful if the application does not have direct control over the NewMenu description, for example if it has user-configurable menus. The default is FALSE. GTMN_SecondaryError (ULONG *) (New for V37, ignored under V36). This tag allows CreateMenus() to return some secondary error codes. Supply a pointer to a NULL-initialized ULONG, which will receive an appropriate error code as follows: GTMENU_INVALID Invalid menu specification. For instance, a sub-item directly following a menu-title or an incomplete menu. CreateMenus() failed in this case, returning NULL. GTMENU_NOMEM Failed for lack of memory. CreateMenus() returned NULL. GTMENU_TRIMMED The number of menus, items or sub-items exceeded the maximum number allowed so the menu was trimmed. In this case, CreateMenus() does not fail but returns a pointer to the trimmed Menu structure. NULL If no error was detected. CreateMenus() returns a pointer to the first Menu structure created, while all the MenuItem structures and any other Menu structures are attached through the appropriate pointers. If the NewMenu structure begins with an entry of type NM_ITEM or IM_ITEM, then CreateMenus() will return a pointer to the first MenuItem created, since there will be no first Menu structure. If the creation fails, usually due to a lack of memory, CreateMenus() will return NULL. Starting with V37, GadTools will not create any menus, menu items or sub-items in excess of the maximum number allowed by Intuition. Up to 31 menus may be defined, each menu with up to 63 items, each item with up to 31 sub-items. See the "Intuition Menus" chapter for more information on menus and their limitations. If the NewMenu array describes a menu that is too big, CreateMenus() will return a trimmed version. GTMN_SecondaryError can be used to learn when this happens. Menus need to be added to the window with Intuition's SetMenuStrip() function. Before doing this, they must be formatted with a call to LayoutMenus().