How can I distinguish/control the left and right Alt keys and the left and right Ctrl keys in C/C++? I'm writing a typing practice program and want to implement an animated keyboard, that is, when I press a key on the real keyboard, the corresponding key on the keyboard on screen also sinks down, and when I release it, it pops back up too. I have already implemented all keys in the main keyboard area except Alt and Ctrl, but the left and right Ctrl and Alt seem to have the same code. I'd appreciate guidance from an expert.
This is the function I use to get the key code: (using Turbo C 2.0 or Turbo C++ 3.0)
int sckey()
{
union REGS r;
unsigned char KEY_CODE=0;
KEY_CODE=inportb(0x60);
r.h.ah=0x0c;
int86(0x21,&r,&r);
return KEY_CODE;
}
This is the function I use to get the key code: (using Turbo C 2.0 or Turbo C++ 3.0)
int sckey()
{
union REGS r;
unsigned char KEY_CODE=0;
KEY_CODE=inportb(0x60);
r.h.ah=0x0c;
int86(0x21,&r,&r);
return KEY_CODE;
}

