Share via


CWnd::OnAppCommand

The framework calls this member function when the user generates an application command event. Such an event occurs when the user clicks an application command button or types an application command key.

afx_msg void OnAppCommand(
    CWnd* pWnd,
    UINT nCmd,
    UINT nDevice,
    UINT nKey
);

Parameters

Parameter

Description

[in] pWnd

Pointer to a CWnd object that represents the window where the user clicked the comman button or pressed the command key. This window can be a child window of the window receiving the message.

[in] nCmd

Indicates the application command. For a list of possible values, see the commands under the cmd section of the lParam parameter of WM_APPCOMMAND.

[in] nDevice

The input device that generated the input event. For a list of possible values, see the devices under the uDevice section of the lParam parameter of WM_APPCOMMAND.

[in] nKey

Indicates any virtual keys that are down, such as the CTRL key or the left mouse button. For a list of possible values, see the keys under the dwKeys section of the lParam parameter of WM_APPCOMMAND. For more information, see the "Message Parameters" subheading in About Mouse Input.

Remarks

This method receives the WM_APPCOMMAND notification, which is described in the Windows SDK.

Note

This member function is called by the framework to allow your application to handle a Windows message. The parameters passed to your function reflect the parameters received by the framework when the message was received. If you call the base-class implementation of this function, that implementation will use the parameters originally passed with the message and not the parameters you supply to the function.

Requirements

Header: afxwin.h

This method is supported in Windows Vista and later.

Additional requirements for this method are described in Build Requirements for Windows Vista Common Controls.

See Also

Reference

CWnd Class

Hierarchy Chart

WM_APPCOMMAND