WM_APPCOMMAND message

Notifies a window that the user generated an application command event, for example, by clicking an application command button using the mouse or typing an application command key on the keyboard.

#define WM_APPCOMMAND                   0x0319

Parameters

wParam

A handle to the window where the user clicked the button or pressed the key. This can be a child window of the window receiving the message. For more information about processing this message, see the Remarks section.

lParam

Use the following code to get the information contained in the lParam parameter.

cmd  = GET_APPCOMMAND_LPARAM(lParam);

uDevice = GET_DEVICE_LPARAM(lParam);

dwKeys = GET_KEYSTATE_LPARAM(lParam);

The application command is cmd, which can be one of the following values.

Value Meaning
APPCOMMAND_BASS_BOOST
20
Toggle the bass boost on and off.
APPCOMMAND_BASS_DOWN
19
Decrease the bass.
APPCOMMAND_BASS_UP
21
Increase the bass.
APPCOMMAND_BROWSER_BACKWARD
1
Navigate backward.
APPCOMMAND_BROWSER_FAVORITES
6
Open favorites.
APPCOMMAND_BROWSER_FORWARD
2
Navigate forward.
APPCOMMAND_BROWSER_HOME
7
Navigate home.
APPCOMMAND_BROWSER_REFRESH
3
Refresh page.
APPCOMMAND_BROWSER_SEARCH
5
Open search.
APPCOMMAND_BROWSER_STOP
4
Stop download.
APPCOMMAND_CLOSE
31
Close the window (not the application).
APPCOMMAND_COPY
36
Copy the selection.
APPCOMMAND_CORRECTION_LIST
45
Brings up the correction list when a word is incorrectly identified during speech input.
APPCOMMAND_CUT
37
Cut the selection.
APPCOMMAND_DICTATE_OR_COMMAND_CONTROL_TOGGLE
43
Toggles between two modes of speech input: dictation and command/control (giving commands to an application or accessing menus).
APPCOMMAND_FIND
28
Open the Find dialog.
APPCOMMAND_FORWARD_MAIL
40
Forward a mail message.
APPCOMMAND_HELP
27
Open the Help dialog.
APPCOMMAND_LAUNCH_APP1
17
Start App1.
APPCOMMAND_LAUNCH_APP2
18
Start App2.
APPCOMMAND_LAUNCH_MAIL
15
Open mail.
APPCOMMAND_LAUNCH_MEDIA_SELECT
16
Go to Media Select mode.
APPCOMMAND_MEDIA_CHANNEL_DOWN
52
Decrement the channel value, for example, for a TV or radio tuner.
APPCOMMAND_MEDIA_CHANNEL_UP
51
Increment the channel value, for example, for a TV or radio tuner.
APPCOMMAND_MEDIA_FAST_FORWARD
49
Increase the speed of stream playback. This can be implemented in many ways, for example, using a fixed speed or toggling through a series of increasing speeds.
APPCOMMAND_MEDIA_NEXTTRACK
11
Go to next track.
APPCOMMAND_MEDIA_PAUSE
47
Pause. If already paused, take no further action. This is a direct PAUSE command that has no state. If there are discrete Play and Pause buttons, applications should take action on this command as well as APPCOMMAND_MEDIA_PLAY_PAUSE.
APPCOMMAND_MEDIA_PLAY
46
Begin playing at the current position. If already paused, it will resume. This is a direct PLAY command that has no state. If there are discrete Play and Pause buttons, applications should take action on this command as well as APPCOMMAND_MEDIA_PLAY_PAUSE.
APPCOMMAND_MEDIA_PLAY_PAUSE
14
Play or pause playback. If there are discrete Play and Pause buttons, applications should take action on this command as well as APPCOMMAND_MEDIA_PLAY and APPCOMMAND_MEDIA_PAUSE.
APPCOMMAND_MEDIA_PREVIOUSTRACK
12
Go to previous track.
APPCOMMAND_MEDIA_RECORD
48
Begin recording the current stream.
APPCOMMAND_MEDIA_REWIND
50
Go backward in a stream at a higher rate of speed. This can be implemented in many ways, for example, using a fixed speed or toggling through a series of increasing speeds.
APPCOMMAND_MEDIA_STOP
13
Stop playback.
APPCOMMAND_MIC_ON_OFF_TOGGLE
44
Toggle the microphone.
APPCOMMAND_MICROPHONE_VOLUME_DOWN
25
Decrease microphone volume.
APPCOMMAND_MICROPHONE_VOLUME_MUTE
24
Mute the microphone.
APPCOMMAND_MICROPHONE_VOLUME_UP
26
Increase microphone volume.
APPCOMMAND_NEW
29
Create a new window.
APPCOMMAND_OPEN
30
Open a window.
APPCOMMAND_PASTE
38
Paste
APPCOMMAND_PRINT
33
Print current document.
APPCOMMAND_REDO
35
Redo last action.
APPCOMMAND_REPLY_TO_MAIL
39
Reply to a mail message.
APPCOMMAND_SAVE
32
Save current document.
APPCOMMAND_SEND_MAIL
41
Send a mail message.
APPCOMMAND_SPELL_CHECK
42
Initiate a spell check.
APPCOMMAND_TREBLE_DOWN
22
Decrease the treble.
APPCOMMAND_TREBLE_UP
23
Increase the treble.
APPCOMMAND_UNDO
34
Undo last action.
APPCOMMAND_VOLUME_DOWN
9
Lower the volume.
APPCOMMAND_VOLUME_MUTE
8
Mute the volume.
APPCOMMAND_VOLUME_UP
10
Raise the volume.

The uDevice component indicates the input device that generated the input event, and can be one of the following values.

Value Meaning
FAPPCOMMAND_KEY
0
User pressed a key.
FAPPCOMMAND_MOUSE
0x8000
User clicked a mouse button.
FAPPCOMMAND_OEM
0x1000
An unidentified hardware source generated the event. It could be a mouse or a keyboard event.

The dwKeys component indicates whether various virtual keys are down, and can be one or more of the following values.

Value Meaning
MK_CONTROL
0x0008
The CTRL key is down.
MK_LBUTTON
0x0001
The left mouse button is down.
MK_MBUTTON
0x0010
The middle mouse button is down.
MK_RBUTTON
0x0002
The right mouse button is down.
MK_SHIFT
0x0004
The SHIFT key is down.
MK_XBUTTON1
0x0020
The first X button is down.
MK_XBUTTON2
0x0040
The second X button is down.

Return value

If an application processes this message, it should return TRUE. For more information about processing the return value, see the Remarks section.

Remarks

DefWindowProc generates the WM_APPCOMMAND message when it processes the WM_XBUTTONUP or WM_NCXBUTTONUP message, or when the user types an application command key.

If a child window does not process this message and instead calls DefWindowProc, DefWindowProc will send the message to its parent window. If a top level window does not process this message and instead calls DefWindowProc, DefWindowProc will call a shell hook with the hook code equal to HSHELL_APPCOMMAND.

To get the coordinates of the cursor if the message was generated by a mouse click, the application can call GetMessagePos. An application can test whether the message was generated by the mouse by checking whether lParam contains FAPPCOMMAND_MOUSE.

Unlike other windows messages, an application should return TRUE from this message if it processes it. Doing so will allow software that simulates this message on Windows systems earlier than Windows 2000 to determine whether the window procedure processed the message or called DefWindowProc to process it.

Requirements

Requirement Value
Minimum supported client
Windows 2000 Professional [desktop apps only]
Minimum supported server
Windows 2000 Server [desktop apps only]
Header
Winuser.h (include Windows.h)

See also

Reference

DefWindowProc

GET_APPCOMMAND_LPARAM

GET_DEVICE_LPARAM

GET_KEYSTATE_LPARAM

ShellProc

WM_XBUTTONUP

WM_NCXBUTTONUP

Conceptual

Mouse Input