WM_MENUCHAR

WM_MENUCHAR

chUser = (char) LOWORD(wParam); /* ASCII character */

fuFlag = (UINT) HIWORD(wParam); /* menu flag */

hmenu = (HMENU) lParam; /* handle of menu */

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.

Parameters

chUser

Value of the low-order word of wParam. Specifies the ASCII character that corresponds to the key the user pressed.

fuFlag

Value of the high-order word of wParam. Specifies the type of the active menu. This parameter can be one of the following values:

Value Meaning

MF_POPUP The menu is a pop-up menu.
MF_SYSMENU The menu is a System menu.

hmenu

Value of lParam. Identifies the active menu.

Return Value

An application that processes this message should return one of the following values in the high-order word of the return value:

Value Meaning

0 Informs Windows that it should discard the character that the user pressed and create a short beep on the system speaker.
1 Informs Windows that it should close the active menu.
2 Informs Windows that the low-order word of the return value specifies the zero-based relative position of a menu item. This item is selected by Windows.

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.