WM_MENUSELECT

This message occurs when the user selects a menu item.

Parameter Description  

wParam Identifies the item selected. If the selected item is a menu item, wParam contains the menu-item ID. If the selected item contains a pop-up menu, wParam contains the handle of the pop-up menu.  
lParam The low-order word contains a combination of the following menu flags:  
Parameter Description  

  Value Meaning
  MF_BITMAP Item is a bitmap.
  MF_CHECKED Item is checked.
  MF_DISABLED Item is disabled.
  MF_GRAYED Item is grayed.
  MF_MOUSESELECT Item was selected with a mouse.
  MF_OWNERDRAW Item is an owner-draw item.
  MF_POPUP Item contains a pop-up menu.
  MF_SYSMENU Item is contained in the System menu. The high-order word identifies the menu associated with the message.

Comments

If the low-order word of the lParam parameter contains –1 and the high-order word contains zero, Windows has closed the menu because the user pressed ESC or clicked outside the menu. In this case, wParam will also contain zero.