WM_COMMAND

This message occurs when the user selects an item from a menu, when a control passes a message to its parent window, or when an accelerator key stroke is translated.

Parameter Description  

wParam Contains the menu item, the control ID, or the accelerator ID.  
lParam Specifies whether the message is from a menu, an accelerator, or a control. The low-order word contains zero if the message is from a menu. The high-order word contains 1 if the message is an accelerator message. If the message is from a control, the high-order word of the lParam parameter contains the notification code. The low-order word is the window handle of the control sending the message.  

Comments

Accelerator key strokes that are defined to select items from the System menu are translated into WM_SYSCOMMAND messages.

If an accelerator key stroke that corresponds to a menu item occurs when the window that owns the menu is minimized, no WM_COMMAND message is sent. However, if an accelerator key stroke that does not match any of the items on the window's menu or on the System menu occurs, a WM_COMMAND message is sent, even if the window is minimized.