Microsoft KB Archive/36325

Recognizing the F11 and F12 Keys Using the _KEYBRD_READY PSS ID Number: Q36325 Article last modified on 01-12-1989 PSS database name: S_QuickC

1.01

MS-DOS

Question:

The _bios_keybrd(_KEYBRD_READY) does not recognize the F11 and F12 keys. Is there any way to have them accepted by the _KEYBRD_READY?

Response:

The program below shows that the F11 and F12 are not recognized by _KEYBRD_READY. Run the program, press a key to start the program, then strike the F12 or F11 keys. The keys are not recognized, while other keys work correctly.

The following code demonstrates this problem:


 * 1) include  #include  #include  void main(void);

void main { unsigned service;

getch; while( _bios_keybrd(_KEYBRD_READY) == 0) {    printf(&quot; will it work?\n&quot;); }

printf(&quot;it worked....    YEA!\n&quot;); }

The problem is that the C run time has hardcoded a check with the value 1 for the _KEYBRD_READY parameter; as a result, although you can pass _bios_keybrd a 0x11, it will not work correctly. If you want to use _bios_keybrd instead of a different input scheme, you can do the following:


 * 1) Do it in MASM.
 * 2) Modify the C library (take out the hardcoded check). Change the manifest constant ’_KEYBRD_READ’ from 0 to 0x10h hex.
 * 3) Make the Int 16h call yourself (do not use _bios_keybrd) with Int86.

Copyright Microsoft Corporation 1989.