The 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.
Syntax
WM_APPCOMMAND
WPARAM wParam
LPARAM lParam;
Parameters
- wParam
-
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);
Where
cmd indicates the application command. This parameter can be one of the following values.
APPCOMMAND_BASS_BOOST- Toggle the bass boost on and off.
APPCOMMAND_BASS_DOWN- Decrease the bass.
APPCOMMAND_BASS_UP- Increase the bass.
APPCOMMAND_BROWSER_BACKWARD- Navigate backward.
APPCOMMAND_BROWSER_FAVORITES- Open favorites.
APPCOMMAND_BROWSER_FORWARD- Navigate forward.
APPCOMMAND_BROWSER_HOME- Navigate home.
APPCOMMAND_BROWSER_REFRESH- Refresh page.
APPCOMMAND_BROWSER_SEARCH- Open search.
APPCOMMAND_BROWSER_STOP- Stop download.
APPCOMMAND_CLOSE- Windows XP: Close the window (not the application).
APPCOMMAND_COPY- Windows XP: Copy the selection.
APPCOMMAND_CORRECTION_LIST- Windows XP: Brings up the correction list when a word is incorrectly identified during speech input.
APPCOMMAND_CUT- Windows XP: Cut the selection.
APPCOMMAND_DICTATE_OR_COMMAND_CONTROL_TOGGLE- Windows XP: Toggles between two modes of speech input: dictation and command/control (giving commands to an application or accessing menus).
APPCOMMAND_FIND- Windows XP: Open the Find dialog.
APPCOMMAND_FORWARD_MAIL- Windows XP: Forward a mail message.
APPCOMMAND_HELP- Windows XP: Open the Help dialog.
APPCOMMAND_LAUNCH_APP1- Start App1.
APPCOMMAND_LAUNCH_APP2- Start App2.
APPCOMMAND_LAUNCH_MAIL- Open mail.
APPCOMMAND_MEDIA_CHANNEL_DOWN- Windows XP SP1: Decrement the channel value, for example, for a TV or radio tuner.
APPCOMMAND_MEDIA_CHANNEL_UP- Windows XP SP1: Increment the channel value, for example, for a TV or radio tuner.
APPCOMMAND_MEDIA_FASTFORWARD- Windows XP SP1: 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- Go to next track.
APPCOMMAND_MEDIA_PAUSE- Windows XP SP1: 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- Windows XP SP1: 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- 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- Go to previous track.
APPCOMMAND_MEDIA_RECORD- Windows XP SP1: Begin recording the current stream.
APPCOMMAND_MEDIA_REWIND- Windows XP SP1: 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_SELECT- Go to Media Select mode.
APPCOMMAND_MEDIA_STOP- Stop playback.
APPCOMMAND_MIC_ON_OFF_TOGGLE- Windows XP: Toggle the microphone.
APPCOMMAND_MICROPHONE_VOLUME_DOWN- Windows XP: Increase microphone volume.
APPCOMMAND_MICROPHONE_VOLUME_MUTE- Windows XP: Mute the microphone.
APPCOMMAND_MICROPHONE_VOLUME_UP- Windows XP: Decrease microphone volume.
APPCOMMAND_NEW- Windows XP: Create a new window.
APPCOMMAND_OPEN- Windows XP: Open a window.
APPCOMMAND_PASTE- Windows XP: Paste
APPCOMMAND_PRINT- Windows XP: Print current document.
APPCOMMAND_REDO- Windows XP: Redo last action.
APPCOMMAND_REPLY_TO_MAIL- Windows XP: Reply to a mail message.
APPCOMMAND_SAVE- Windows XP: Save current document.
APPCOMMAND_SEND_MAIL- Windows XP: Send a mail message.
APPCOMMAND_SPELL_CHECK- Windows XP: Initiate a spell check.
APPCOMMAND_TREBLE_DOWN- Decrease the treble.
APPCOMMAND_TREBLE_UP- Increase the treble.
APPCOMMAND_UNDO- Windows XP: Undo last action.
APPCOMMAND_VOLUME_DOWN- Lower the volume.
APPCOMMAND_VOLUME_MUTE- Mute the volume.
APPCOMMAND_VOLUME_UP- Raise the volume.
- Where
uDevice indicates the input device that generated the input event. It can be one of the following values.
FAPPCOMMAND_KEY- User pressed a key.
FAPPCOMMAND_MOUSE- User clicked a mouse button.
FAPPCOMMAND_OEM- An unidentified hardware source generated the event. It could be a mouse or a keyboard event.
- Where
dwKeys indicates whether various virtual keys are down. It can be one or more of the following values.
MK_CONTROL- The CTRL key is down.
MK_LBUTTON- The left mouse button is down.
MK_MBUTTON- The middle mouse button is down.
MK_RBUTTON- The right mouse button is down.
MK_SHIFT- The SHIFT key is down.
MK_XBUTTON1- The first X button is down.
MK_XBUTTON2- 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 button click on the mouse, 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 Microsoft Windows systems earlier than Windows 2000 to determine whether the window procedure processed the message or called DefWindowProc to process it.
Notification Requirements
| Minimum DLL Version |
None |
|---|
| Header | Declared in Winuser.h, include Windows.h |
|---|
| Minimum operating systems |
Millennium, Windows 2000 |
|---|
See Also
Mouse Input Overview, DefWindowProc, GET_APPCOMMAND_LPARAM, GET_DEVICE_LPARAM, GET_KEYSTATE_LPARAM, ShellProc, WM_XBUTTONUP, WM_NCXBUTTONUP