|
Экранная клавиатура
#38070164
Ссылка:
Ссылка на сообщение:
Ссылка с названием темы:
Ссылка на профиль пользователя:
|
|
|
|
http://msdn.microsoft.com/en-us/library/windows/desktop/ms646276%28v=vs.85%29.aspx
1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11.
lParam
The repeat count, scan code, extended-key flag, context code, previous key-state flag, and transition-state flag, as shown in the following table.
Bits Meaning
0-15 The repeat count for the current message. The value is the number of times the keystroke is autorepeated as a result of the user holding down the key. If the keystroke is held long enough, multiple messages are sent. However, the repeat count is not cumulative.
16-23 The scan code. The value depends on the OEM.
24 Indicates whether the key is an extended key, such as the right-hand ALT and CTRL keys that appear on an enhanced 101- or 102-key keyboard. The value is 1 if it is an extended key; otherwise, it is 0.
25-28 Reserved; do not use.
29 The context code. The value is 1 if the ALT key is held down while the key is pressed; otherwise, the value is 0.
30 The previous key state. The value is 1 if the key is down before the message is sent, or it is 0 if the key is up.
31 The transition state. The value is 1 if the key is being released, or it is 0 if the key is being pressed.
вот набрал последовательно а, стрл+а, шифт+а, алт+а
альта нет вообще, а биты (24 + 29 и другие) не меняются. я правыми стрл, шифт и альт пользовался.
259 выводил, чтобы показать, как мои биты выводятся.
почему?
1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29.
application 'Каркасное приложение' started (259:'00000001 00000011')
WM_KEYUP: 13: '(null)'
button pressed( WM_CHAR): 97/a 1 30
!!! 30, 30, add/alt/pb/b (0/0/0/0/0), code: 30/''
bits: '00000000 00011110': b15/b14/p13/b12-9/b8 (0/0/0/0/0), code:30/''
bits2: '00000000 00011110'
WM_KEYUP: 65: '(null)'
button pressed( WM_CHAR): 1/ 1 30
!!! 30, 30, add/alt/pb/b (0/0/0/0/0), code: 30/''
bits: '00000000 00011110': b15/b14/p13/b12-9/b8 (0/0/0/0/0), code:30/''
bits2: '00000000 00011110'
WM_KEYUP: 65: '(null)'
WM_KEYUP: 17: '(null)'
button pressed( WM_CHAR): 65/A 1 30
!!! 30, 30, add/alt/pb/b (0/0/0/0/0), code: 30/''
bits: '00000000 00011110': b15/b14/p13/b12-9/b8 (0/0/0/0/0), code:30/''
bits2: '00000000 00011110'
WM_KEYUP: 65: '(null)'
WM_KEYUP: 16: '(null)'
WM_KEYUP: 18: '(null)'
application stoped
1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33. 34. 35. 36. 37. 38. 39. 40. 41. 42. 43. 44. 45. 46. 47. 48. 49. 50. 51. 52. 53. 54. 55. 56. 57. 58. 59. 60. 61. 62. 63. 64. 65. 66. 67. 68. 69. 70. 71. 72. 73.
struct TWM_CHAR {
unsigned code:8;
unsigned add:1;
unsigned sys:4;
unsigned alt:1;
unsigned pb:1;
unsigned p :1;
};
union SH_WM_CHAR
{
ushort sh;
TWM_CHAR map;
};
TWM_CHAR getMap(ushort prm){
SH_WM_CHAR ret;
ret.sh=prm;
fprintf(out, "!!! %hd, %hd, add/alt/pb/b (%hd/%hd/%hd/%hd/%hd), code: %hd/'%c'\n",
prm, ret.sh,
(ushort) ret.map.add,
(ushort)ret.map.alt,
(ushort)ret.map.pb,
(ushort)ret.map.p,
(ushort)ret.map.sys,
(ushort) ret.map.code,
ret.map.code);
return ret.map;
}
LRESULT CALLBACK WindowProc(HWND hWnd, UINT uMessage, WPARAM wParam, LPARAM lParam)
{
int result;
uchar buf[20]; memset(buf, 20, 0);
uchar but = wParam;
ushort h = HIWORD(lParam);
ushort l = LOWORD(lParam);
TWM_CHAR map;
ushort *psh = (ushort*) ↦
const uchar *nm = 0;
switch(uMessage)
{
case WM_CHAR: // нажатие клавиши.
fprintf(out, "button pressed( WM_CHAR): %d/%c The repeat count: %hd 16-31:%hd\n",
wParam, but, l, h);
;
map= getMap(h);
// 31 /30/ 29/28-25/24 16-23
fprintf(out, "bits: '%s': b15/b14/p13/b12-9/b8 (%hd/%hd/%hd/%hd/%hd), scan-code:%hd/'%c'\n"
,stoa(h, buf)
,(ushort)map.p
,(ushort)map.pb
,(ushort)map.alt
,(ushort)map.sys
,(ushort) map.add
,(ushort) map.code
, (uchar) map.code);
fprintf(out, "bits2: '%s'\n", stoa(*psh, buf));
break;
|
|
|