|
|
Microsoft OS/2 SDK 03-01-1988
/*
* keys.c - Demonstrate the MS OS/2 call KbdCharIn
*
* This program runs in the forground. Cooked keystrokes are printed
* to the console. Typing an ESC charactor terminates the program.
*
* This program can be bound to work under DOS 3.x (Family API).
*
* Created by Microsoft Corp. 1986
*/
#define IOWAIT 0
#define ESC '\033'
#define COOKED 0x04
#define RAW 0x08
#define INCL_SUB
#include <os2def.h>
#include <bsesub.h>
#include <stdio.h>
main ()
{
KBDKEYINFO keydata;
KBDINFO kbdstatus;
kbdstatus.cb = sizeof(kbdstatus);
KbdGetStatus(&kbdstatus, 0);
kbdstatus.fsMask &= ~(RAW | COOKED);
kbdstatus.fsMask |= COOKED;
KbdSetStatus (&kbdstatus, 0);
do {
KbdCharIn(&keydata, IOWAIT, 0);
printf("char: %02X scan: %02X status: %02X shift: %04X\n",
keydata.chChar,
keydata.chScan,
keydata.fbStatus,
keydata.fsState);
} while (keydata.chChar != ESC);
}
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.