Command Items and Items that Open Submenus
When the user chooses a command item, Windows sends a command message to the window that owns the menu. If the command item is on the window menu, Windows sends the WM_SYSCOMMAND message. Otherwise, it sends the WM_COMMAND message.
Associated with each menu item that opens a submenu is the handle of the corresponding submenu. When the user points to such an item, Windows opens the submenu. No command message is sent to the owner window. However, Windows sends a WM_INITMENUPOPUP message to the owner window before displaying the submenu. You can get the handle of the submenu associated with an item by using the GetSubMenu or GetMenuItemInfo function.
A menu bar typically contains menu names, but it can also contain command items. A submenu typically contains command items, but it can also contain items that open nested submenus. By adding such items to submenus, you can nest menus to any depth. To provide a visual cue for the user, Windows automatically displays a small arrow to the right of the text of a menu item that opens a submenu.