You can read ROM bios data address :
#include <stdio.h>
#include <conio.h>
#define KEY_ADDRESS 0x417 /* ROM BIOS data address */
#define KEY_RSHIFT 0x01
#define KEY_LSHIFT 0x02
#define KEY_CTRL 0x04
#define KEY_ALT 0x08
#define KEY_SCROLL 0x10
#define KEY_NUMLOCK 0x20
#define KEY_CAPSLOCK 0x40
#define KEY_INS 0x80
int main( void )
{
getch();
if( *((char*)KEY_ADDRESS) & KEY_ALT ) {
puts( "Alt key was pressed" );
}
return 0;
}
Compile and execute this program. And then it waits
a key input and you can press alt key at that time.
Hold the alt key and now press any key ( if you
use a dos console on Windows, esc, enter, space, ...
keys can give the special meaning to Windows so use
an alphabet or a digit key for this case. )
to return the 'getch' function. If this program
works fine for you, you can see the message
"Alt key was pressed".
Hee S. Chung
heesc@netian.com