#define DEF_APRESS_TIME 1000 |
Default always pressed time of a key.
#define DEF_INTERVAL_TIME 200 |
#define DEF_LPRESS_TIME 500 |
Default long pressed time of a key.
#define MSG_CHAR 0x0011 |
A character translated from MSG_KEYDOWN message.
This message is translated from a MSG_KEYDOWN message by TranslateMessage and sent to the current active window.
ch | The ASCII code of the pressed key. | |
key_flags | The shift key status when this message occurred. |
#define MSG_KEYALWAYSPRESS 0x0018 |
#define MSG_KEYDOWN 0x0010 |
User presses a key down.
This message is posted to the current active window when the user presses a key down.
MSG_KEYDOWN int scancode = (int)wParam; DWORD key_flags = (DWORD)lParam;
scancode | The scan code of the pressed key. | |
key_flags | The shift key status when this message occurred. |
Example:
/* * This example trys to handle the event when the user * presses <C> key as the <Ctrl> key is down. */ int MyWinProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam) { switch (message) { case MSG_KEYDOWN: if (wParam ==SCANCODE_C && lParam & KS_CTRL) { // User pressed Ctrl+C. break; } break; ... } return DefaultMainWinProc (hWnd, message, wParam, lParam); }
#define MSG_KEYLONGPRESS 0x0017 |
#define MSG_KEYSYM 0x0016 |
A key symbol translated from MSG_KEYDOWN messages.
This message is translated from a MSG_KEYDOWN message by TranslateMessage and sent to the current active window.
Note that one translation may generate a key symbol made by more than one character, e.g., when using default keymap, DEL key will generate the key symbol "^[[3~".
MSG_KEYSYM int index = HIBYTE (wParam); int keysym = LOBYTE (wParam); DWORD key_flags = (DWORD)lParam;
index | The index of the key symbol in one translation, zero for a new translation, and the keysym is the first symbol. | |
keysym | The code of the key symbol. | |
key_flags | The shift key status when this message occurred. |
#define MSG_KEYUP 0x0012 |
User releases up a key.
This message is posted to the current active window when the user releases up a key.
scancode | The scan code of the released key. | |
key_flags | The shift key status when this message occurred. |
#define MSG_SYSCHAR 0x0014 |
A system character translated from MSG_SYSKEYDOWN message.
This message is translated from a MSG_SYSKEYDOWN message by TranslateMessage and sent to the current active window.
MSG_SYSCHAR int ch = (int)wParam; DWORD key_flags = (DWORD)lParam;
ch | The ASCII code of the pressed key. | |
key_flags | The shift key status when this message occurred. |
#define MSG_SYSKEYDOWN 0x0013 |
User presses down a key when <Alt> key is down.
This message is posted to the current active window when the user presses down a key as <Alt> key is down.
MSG_SYSKEYDOWN int scancode = (int)wParam; DWORD key_flags = (DWORD)lParam;
scancode | The scan code of the pressed key. | |
key_flags | The shift key status when this message occurred. |
#define MSG_SYSKEYUP 0x0015 |
User releases up a key when <Alt> key is down.
This message is posted to the current active window when the user releases up a key as <Alt> key is down.
MSG_SYSKEYUP int scancode = (int)wParam; DWORD key_flags = (DWORD)lParam;
scancode | The scan code of the released key. | |
key_flags | The shift key status when this message occurred. |
#define SetIntervalTime | ( | time | ) |
#define SetKeyAlwaysPressTime | ( | time | ) |