CWnd::OnMenuChar

Syntax

afx_msg LONG OnMenuChar( UINT nChar, UINT nFlags, CMenu* pMenu );

Parameters

nChar

Specifies the ASCII character that the user pressed.

nFlags

Contains the MF_POPUP flag if the menu is a pop-up menu. It contains the MF_SYSMENU flag if the menu is a Control menu.

pMenu

Contains a pointer to the selected CMenu. The pointer may be temporary, and should not be stored.

Remarks

Called when the user presses a menu mnemonic character that doesn't match any of the predefined mnemonics in the current menu. It is sent to the CWnd that owns the menu.

This message-handler member function calls the Default member function. Override this member function in your derived class to handle the WM_MENUCHAR message.

Return Value

The high-order word of the return value should contain one of the following command codes:

Value Description

0 Tells Windows to discard the character that the user pressed, and creates a short beep on the system speaker.
1 Tells Windows to close the current menu.
2 Informs Windows that the low-order word of the return value contains the menu item-number for a specific item. This item is selected by Windows.

The low-order word is ignored if the high-order word contains 0 or 1. Applications should process this message when accelerators are used to select bitmaps placed in a menu.

See Also

CWnd::Default, WM_MENUCHAR