Microsoft KB Archive/43007

{|
 * width="100%"|

Reading Extended Keyboard Characters with C

 * }

Q43007

6.00 6.00a 6.00ax 7.00 | 1.00 1.50 MS-DOS | WINDOWS kbprg -- The information in this article applies to: - Microsoft C for MS-DOS, versions 6.0, 6.0a, and 6.0ax - Microsoft C/C++ for MS-DOS, version 7.0 - Microsoft Visual C++ for Windows, versions 1.0 and 1.5 -- SUMMARY ======= The _bios_keybrd function uses INT function 16H to access the keyboard services. The C 5.1 _bios_keybrd function is based on the original PC BIOS INT 16H, which does not support the extended keyboard. The BIOS for AT's and PS/2's has been updated to support the extended keyboard. The updated BIOS has three addition services: 10H reads a character from the extended keyboard, 11H gets the extended-keyboard status, 12H gets the extended-keyboard flags. To allow the C 5.1 _bios_keybrd to use these updated keyboard services, define the following manifest constants. #define _NKEYBRD_READ 0x10 /* read extended chars */ #define _NKEYBRD_READY 0x11 /* check if key waiting */ #define _NKEYBRD_SHIFT_STATUS 0x12 /* check shift key status */ To read keys from the extended keyboard, use these new constants in place of the manifest constants described on page 138 of the &quot;Microsoft C for the MS-DOS Operating System: Run-Time Library Reference&quot; for version 5.1. These constants are already defined in C versions 6.0 and later. MORE INFORMATION ================ The following program uses the enhanced services of INT function 16H to determine if the UP ARROW or DOWN ARROW keys on the extended keyboard were pressed. Uncomment the #define for C 5.1 and earlier. Sample Code: /* Compile options needed: none */ /* #define _NKEYBRD_READ 0x10 */ #include #include void main { unsigned key; key = _bios_keybrd( _NKEYBRD_READ ); if ( key == 0x48e0 ) printf( &quot;Up arrow was pressed.\n&quot; ); else if ( key == 0x50e0 ) printf( &quot;Down arrow was pressed.\n&quot; ); else printf( &quot;Neither the up or the down arrow was pressed.\n&quot; ); } Additional reference words: kbinf 6.00 6.00a 6.00ax 7.00 1.00 1.50 KBCategory: kbprg KBSubcategory: CLngIss

Keywords : kb16bitonly

Issue type :

Technology : kbVCsearch kbAudDeveloper kbPTProdChange kbvc150 kbvc100 kbCCompSearch kbZNotKeyword3 kbCComp600DOS kbCComp600aDOS kbCComp600axDOS kbCVC700DOS