WM COMMAND: Difference between revisions
No edit summary |
|||
Line 56: | Line 56: | ||
==Related Messages== | ==Related Messages== | ||
* WM_SYSCOMMAND (in Title Bar Controls) | * WM_SYSCOMMAND (in Title Bar Controls) | ||
[[Category:Messages]] | [[Category:Messages]] |
Latest revision as of 17:57, 19 May 2024
This message occurs when a control has a significant event to notify to its owner, or when a key stroke has been translated by an accelerator table.
- in Button Controls
- Button control sets uscmd to the button identity and ussource to CMDSRC_PUSHBUTTON.
- in Menu Controls
- The menu control window procedure sets uscmd to the menu-item identity.
Syntax
param1 USHORT uscmd /* Command value. */ param2 USHORT ussource /* Source type. */ USHORT uspointer /* Pointer-device indicator. */
Parameters
- uscmd (USHORT)
- Command value.
- It is the responsibility of the application to be able to relate uscmd to an application function.
- ussource (USHORT)
- Source type.
- Identifies the type of control:
- CMDSRC_PUSHBUTTON - Posted by a push-button control. uscmd is the window identity of the push button.
- CMDSRC_MENU - Posted by a menu control. uscmd is the identity of the menu item.
- CMDSRC_ACCELERATOR - Posted as the result of an accelerator. uscmd is the accelerator command value.
- CMDSRC_FONTDLG - Font dialog. uscmd is the identity of the font dialog.
- CMDSRC_FILEDLG - File dialog. uscmd is the identity of the file dialog.
- CMDSRC_OTHER - Other source. uscmd gives further control-specific information defined for each control type.
- uspointer (USHORT)
- Pointer-device indicator.
- TRUE - The message is posted as a result of a pointer-device operation.
- FALSE - The message is posted as a result of a keyboard operation.
Returns
- ulReserved (ULONG)
- Reserved value, should be 0.
Remarks
This message is posted to the queue of the owner of the control.
WM_Command handles popup menu command identifiers for pickup, putdown and cancel drag operations. It determines which items to display based on the state of the lazy drag and droppability of the lazy drag set.
- in Button Controls
- The button control generates this message when a push button of style BS_PUSHBUTTON is pressed or when it receives a BM_CLICK message. The button control posts the message to the queue of the control owner.
- in Menu Controls
The menu control window procedure generates this message if the WM_MENUSELECT (in Menu Controls) message returns a rc of TRUE. when an item is selected that does not have the style of MIS_SYSCOMMAND or MIS_HELP. The menu control window procedure posts the message to the queue of the window owner.
Default Processing
The default window procedure takes no action on this message, other than to set ulReserved to 0.
- in Button Controls
- The default dialog procedure responds to this message by dismissing the dialog and passing uscmd (the control item identifier) as of the WinProcessDlg or the WinDlgBox function that initiated the dialog. It sets ulReserved to 0.
- In Default Dialogs
- The default dialog procedure responds to this message by dismissing the dialog and passing uscmd (the control item identifier) as of the WinProcessDlg or the WinDlgBox function that initiated the dialog. It sets ulReserved to 0.
- in Menu Controls
- The default window procedure takes no action on this message, other than to set ulReserved to 0.
Related Messages
- WM_SYSCOMMAND (in Title Bar Controls)