蹩脚读MSDN之WM_COMMAND
The WM_COMMAND message is sent when the user selects a command item from a menu, when a control sends a notification message to its parent window, or when an accelerator keystroke is translated.
当用户从菜单选中一个命令选项或者控件向父窗口发送消息或者接受到一个快捷键信息时会接受到该消息
A window receives this message through its WindowProc function.
窗口的回调函数接受到WM_COMMAND消息
LRESULT CALLBACK WindowProc(
HWND hwnd, // handle to window 窗口句柄
WM_COMMAND, // the message to send
WPARAM wParam, // notification code and identifier
LPARAM lParam // handle to control (HWND)
);
Parameters
wParam
The high-order word specifies the notification code if the message is from a control. If the message is from an accelerator, this value is 1. If the message is from a menu, this value is zero.
如果消息来自一个控件则wparam的高位返回通知码
如果该消息来自快捷键 则wparam的高位返回返回1
如果该消息来自命令菜单 则wparam的高位返回返回0
The low-order word specifies the identifier of the menu item, control, or accelerator.
无论消息是来自控件 快捷键 还是命令菜单 wparam的低位都表示该
控件(快捷键.命令菜单)的ID
lParam
Handle to the control sending the message if the message is from a control. Otherwise, this parameter is NULL.
如果消息来自控件则lparam返回该消息的句柄 否则返回NULL
Return Values
If an application processes this message, it should return zero.
如果应用程序处理此消息时,它应返回零。