CWnd::OnCommand

Syntax

virtual BOOL OnCommand( UINT wParam, LONG lParam );

Parameters

wParam

Identifies the menu item or control.

lParam

Specifies additional information. If the message is from a menu, the low-order word and the high-order word are both 0. If the message is from an accelerator, the low-order word is 0 and the high-order word is 1. If the message is from a control, the low-order word is the handle of the window sending the message and the high-order word is the notification code.

Remarks

Called when the user selects an item from a CWnd menu, when a child control sends a notification message to CWnd, or when an access keystroke is translated.

Access keystrokes that are defined to select items from the Control menu are translated to WM_SYSCOMMAND messages.

If an access keystroke that corresponds to a menu item occurs when the CWnd is minimized, OnCommand is not called. However, if an access keystroke that does not match any of the items on the CWnd menu or on the Control menu occurs, OnCommand is called, even if CWnd is minimized.

OnCommand processes the message map for control notification and ON_COMMAND entries, and calls the appropriate member function.

Override this member function in your derived class to handle the WM_COMMAND message. An override will not process the message map unless the base class OnCommand is called.

Return Value

An application returns TRUE if it processes this message; otherwise FALSE.

See Also

WM_SYSCOMMAND, WM_COMMAND