ExMessage
This structure is used to hold message and is defined as follows:
struct ExMessage
{
USHORT message; // The message identifier.
union
{
// Data of the mouse message
struct
{
bool ctrl :1; // Indicates whether the CTRL key is down.
bool shift :1; // Indicates whether the SHIFT key is down.
bool lbutton :1; // Indicates whether the left mouse button is down.
bool mbutton :1; // Indicates whether the middle mouse button is down.
bool rbutton :1; // Indicates whether the right mouse button is down.
short x; // The x-coordinate of the cursor.
short y; // The y-coordinate of the cursor.
short wheel; // The distance the wheel is rotated, expressed in multiples or divisions of 120.
};
// Data of the key message
struct
{
BYTE vkcode; // The virtual-key code of the key.
BYTE scancode; // The scan code of the key. The value depends on the OEM.
bool extended :1; // Indicates whether the key is an extended key.
bool prevdown :1; // Indicates whether the key is previously up or down.
};
// Data of the char message
TCHAR ch;
// Data of the window message
struct
{
WPARAM wParam;
LPARAM lParam;
};
};
};
Members
message
Specify the message identifier, which can be the following values.
Message identifier | Message category | Description |
---|---|---|
WM_MOUSEMOVE | EX_MOUSE | The mouse moves. |
WM_MOUSEWHEEL | EX_MOUSE | The mouse wheel is rotated. |
WM_LBUTTONDOWN | EX_MOUSE | The left mouse button is pressed. |
WM_LBUTTONUP | EX_MOUSE | The left mouse button is released. |
WM_LBUTTONDBLCLK | EX_MOUSE | The left mouse button is double-clicked. |
WM_MBUTTONDOWN | EX_MOUSE | The middle mouse button is pressed. |
WM_MBUTTONUP | EX_MOUSE | The middle mouse button is released. |
WM_MBUTTONDBLCLK | EX_MOUSE | The middle mouse button is double-clicked. |
WM_RBUTTONDOWN | EX_MOUSE | The right mouse button is pressed. |
WM_RBUTTONUP | EX_MOUSE | The right mouse button is released. |
WM_RBUTTONDBLCLK | EX_MOUSE | The right mouse button is double-clicked. |
WM_KEYDOWN | EX_KEY | A key is pressed. |
WM_KEYUP | EX_KEY | A key is released. |
WM_CHAR | EX_CHAR | A character is typed. |
WM_ACTIVATE | EX_WINDOW | The window is activated or deactivated. |
WM_MOVE | EX_WINDOW | The window has been moved. |
WM_SIZE | EX_WINDOW | The size of window has changed. |
ctrl
Indicates whether the Ctrl key is pressed. It is valid only when the message category is EX_MOUSE.
shift
Indicates whether the SHIFT key is pressed. It is valid only when the message category is EX_MOUSE.
lbutton
Indicates whether the left mouse button is pressed. It is valid only when the message category is EX_MOUSE.
mbutton
Indicates whether the middle mouse button is pressed. It is valid only when the message category is EX_MOUSE.
rbutton
Indicates whether the right mouse button is pressed. It is valid only when the message category is EX_MOUSE.
x
The x-coordinate of the cursor (physical coordinates). It is valid only when the message category is EX_MOUSE.
y
The y-coordinate of the cursor (physical coordinates). It is valid only when the message category is EX_MOUSE.
wheel
The mouse wheel scroll value, a multiple of 120. It is valid only when the message category is EX_MOUSE.
vkcode
The virtual-key code of the key. It is valid only when the message category is EX_KEY.
All virtual-key codes are listed on the Microsoft website: https://docs.microsoft.com/windows/win32/inputdev/virtual-key-codes
scancode
The scan code of the key. The value depends on the OEM. It is valid only when the message category is EX_KEY.
extended
Indicates whether the key is an extended key, such as a function key or a key on the numeric keypad. It is valid only when the message category is EX_KEY.
prevdown
Indicates whether the key is previously up or down. It is valid only when the message category is EX_KEY.
ch
The character received. It is valid only when the message category is EX_CHAR.
wParam
The wParam parameter corresponding to the message. It is valid only when the message category is EX_WINDOW.
lParam
The lParam parameter corresponding to the message. It is valid only when the message category is EX_WINDOW.
Examples
None