China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-08-01 00:10
中国DOS联盟论坛 » DOS开发编程 & 发展交流 (开发室) » Question for the experts! View 1,272 Replies 0
Original Poster Posted 2003-07-23 00:00 ·  中国 湖北 武汉 鹏博士宽带
中级用户
★★
Credits 286
Posts 59
Joined 2003-04-08 00:00
23-year member
UID 1437
Gender Male
Status Offline
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;
}






Forum Jump: