The WM_MENUCHAR message is sent when a menu is active and the user presses a key that does not correspond to any mnemonic or accelerator key. This message is sent to the window that owns the menu.
WM_MENUCHAR chUser = (TCHAR) LOWORD(wParam); // character code fuFlag = (UINT) HIWORD(wParam); // menu flag hmenu = (HMENU) lParam; // handle of menu
Value |
Meaning |
MF_POPUP |
drop-down menu, submenu, or shortcut menu |
MF_SYSMENU |
window menu (System menu or Control menu) |
An application that processes this message should return one of the following values in the high-order word of the return value:
Value |
Meaning |
MNC_IGNORE |
Informs Windows that it should discard the character the user pressed and create a short beep on the system speaker. |
MNC_CLOSE |
Informs Windows that it should close the active menu. |
MNC_EXECUTE |
Informs Windows that it should choose the item specified in the low-order word of the return value. The owner window receives a WM_COMMAND message. |
MNC_SELECT |
Informs Windows that it should select the item specified in the low-order word of the return value. |
The low-order word is ignored if the high-order word contains 0 or 1. An application should process this message when an accelerator is used to select a menu item that displays a bitmap.