--- os2sdk/demos/examples/keys/keys.c 2018/08/09 12:25:13 1.1 +++ os2sdk/demos/examples/keys/keys.c 2018/08/09 12:26:19 1.1.1.2 @@ -1,37 +1,41 @@ /* - * keys.c - Demonstrate the OS/2 call KBDCHARIN + * 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 -#include +#define INCL_SUB + +#include +#include #include main () { - struct KeyData keydata; - struct KbdStatus kbdstatus; + KBDKEYINFO keydata; + KBDINFO kbdstatus; - kbdstatus.length = sizeof(kbdstatus); - KBDGETSTATUS(&kbdstatus, 0); - kbdstatus.bit_mask &= ~(RAW | COOKED); - kbdstatus.bit_mask |= COOKED; - KBDSETSTATUS (&kbdstatus, 0); + kbdstatus.cb = sizeof(kbdstatus); + KbdGetStatus(&kbdstatus, 0); + kbdstatus.fsMask &= ~(RAW | COOKED); + kbdstatus.fsMask |= COOKED; + KbdSetStatus (&kbdstatus, 0); do { - KBDCHARIN(&keydata, IOWAIT, 0); + KbdCharIn(&keydata, IOWAIT, 0); printf("char: %02X scan: %02X status: %02X shift: %04X\n", - keydata.char_code, - keydata.scan_code, - keydata.status, - keydata.shift_state); + keydata.chChar, + keydata.chScan, + keydata.fbStatus, + keydata.fsState); - } while (keydata.char_code != ESC); + } while (keydata.chChar != ESC); }