L
lolzy
Hello comp.lang.c!
I'am trying to convert a virtual key to a normal character (just a
human readable character). This is my code:
LPWORD r;
SHORT c = /* Some virtual key */
byte ba[256];
r = calloc(3, sizeof(char));
/* Init keybord status */
if (GetKeyboardState(ba) == 0)
{
printf("ERROR: Could not get keybord status.");
exit(1);
}
ToAscii(c, MapVirtualKey(c, 0), ba, r, 0);
putc(r[0]);
This code works. BUT not 100% hehe, when holding the shift key the
ToAscii function still returns the 'normal' characters, for example
lower case characters instead of uppercase, [ instead of {, etc.
Thanks in advance!
Jori.
I'am trying to convert a virtual key to a normal character (just a
human readable character). This is my code:
LPWORD r;
SHORT c = /* Some virtual key */
byte ba[256];
r = calloc(3, sizeof(char));
/* Init keybord status */
if (GetKeyboardState(ba) == 0)
{
printf("ERROR: Could not get keybord status.");
exit(1);
}
ToAscii(c, MapVirtualKey(c, 0), ba, r, 0);
putc(r[0]);
This code works. BUT not 100% hehe, when holding the shift key the
ToAscii function still returns the 'normal' characters, for example
lower case characters instead of uppercase, [ instead of {, etc.
Thanks in advance!
Jori.