To have the system automatically assign a specific menu to a window, specify the menu's template when you register the window's class. Another way you can assign a menu to a window is to specify a menu template when you register a window class the template identifies the specified menu as the class menu for that window class. To assign a menu to a window, use the SetMenu function or specify the menu's handle in the hMenu parameter of the CreateWindowEx function when creating a window. This is useful if your application generates menu templates dynamically. To create a menu from a menu template that is already in memory, use the LoadMenuIndirect function. This window becomes the menu's owner window, receiving all the messages generated by the menu. The LoadMenu function returns a menu handle that you can use to assign the menu to a window. To load a menu-template resource, use the LoadMenu function, specifying a handle to the module that contains the resource and the menu template's identifier. An old menu-template resource has the RT_MENU resource type.Īn old menu template consists of a MENUITEMTEMPLATEHEADER structure followed by one or more MENUITEMTEMPLATE structures. Old Menu-Template FormatĪn old menu template (Microsoft Windows NT 3.51 and earlier) defines a menu, but does not support the new menu functionality.
The system distinguishes the two resource formats by the version number, which is the first member of the resource header.Īn extended menu template consists of a MENUEX_TEMPLATE_HEADER structure followed by one more MENUEX_TEMPLATE_ITEM item definition structures. Like standard menu-template resources, extended menu-template resources have the RT_MENU resource type. The extended menu-template format supports additional menu functionality. For information about creating a menu-template resource, see the documentation included with your development tools.
#How to load enb from menu how to
This section describes the format of a menu template, and explains how to load a menu-template resource and use it in your application. You typically include a menu in an application by creating a menu-template resource and then loading the menu at run time.