|
|
1.1 root 1: /* 1.1.1.2 ! root 2: * keys.c - Demonstrate the MS OS/2 call KbdCharIn 1.1 root 3: * 4: * This program runs in the forground. Cooked keystrokes are printed 5: * to the console. Typing an ESC charactor terminates the program. 6: * 7: * This program can be bound to work under DOS 3.x (Family API). 8: * 1.1.1.2 ! root 9: * Created by Microsoft Corp. 1986 1.1 root 10: */ 11: #define IOWAIT 0 12: #define ESC '\033' 13: #define COOKED 0x04 14: #define RAW 0x08 15: 1.1.1.2 ! root 16: #define INCL_SUB ! 17: ! 18: #include <os2def.h> ! 19: #include <bsesub.h> 1.1 root 20: #include <stdio.h> 21: main () 22: { 1.1.1.2 ! root 23: KBDKEYINFO keydata; ! 24: KBDINFO kbdstatus; 1.1 root 25: 1.1.1.2 ! root 26: kbdstatus.cb = sizeof(kbdstatus); ! 27: KbdGetStatus(&kbdstatus, 0); ! 28: kbdstatus.fsMask &= ~(RAW | COOKED); ! 29: kbdstatus.fsMask |= COOKED; ! 30: KbdSetStatus (&kbdstatus, 0); 1.1 root 31: 32: do { 1.1.1.2 ! root 33: KbdCharIn(&keydata, IOWAIT, 0); 1.1 root 34: printf("char: %02X scan: %02X status: %02X shift: %04X\n", 1.1.1.2 ! root 35: keydata.chChar, ! 36: keydata.chScan, ! 37: keydata.fbStatus, ! 38: keydata.fsState); 1.1 root 39: 1.1.1.2 ! root 40: } while (keydata.chChar != ESC); 1.1 root 41: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.