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.
当用户选择从一个菜单选择一个命令或者一个控制发送通知给其父窗口,或者一个快捷键按下时会发出WM_COMMAND消息
WM_COMMAND
wNotifyCode = HIWORD(wParam); // notification code
wID = LOWORD(wParam); // item, control, or accelerator identifier 菜单、按钮或者快捷键
hwndCtl = (HWND) lParam; // handle of control 按钮句柄
Parameters
-
wNotifyCode
- Value of the high-order word of wParam. Specifies the notification code if the message is from a control. If the message is from an accelerator, this parameter is 1. If the message is from a menu, this parameter is 0.
- wParam的高字节,指定通知码是否来自一个按钮,当消息是来自一个快捷键时,这个值为1,如果来自菜单,则是0. wID
- Value of the low-order word of wParam. Specifies the identifier of the menu item, control, or accelerator.
- wParam的低字节,指定菜单项、按钮或者快捷键的ID hwndCtl
- Value of lParam. Handle to the control sending the message if the message is from a control. Otherwise, this parameter is NULL.
- lParam的值,当消息来自一个按钮时,句柄记录在lParam中,否则这个元素为NULL