7.3.1 Specifying the Menu for a Window Class

When you register a window class, you are setting the default attributes (including the default menu) for all windows in that class. The default menu for a window class is known as the class menu. You can override this default menu by explicitly supplying a menu handle when you create a window of that class. To specify the class menu when you register the window class, assign the name of the menu, as given in the resource-definition file, to the lpszMenuName member of the window-class structure, as follows:

wc.lpszMenuName = "SampleMenu";

In this example, lpszMenuName is part of a WNDCLASS structure named wc. The menu name SampleMenu is the name given to the menu in the application's resource-definition file.