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:
- include <stdio.h> #include <bios.h> #include <conio.h> void main(void);
void main() { unsigned service;
getch(); while( _bios_keybrd(_KEYBRD_READY) == 0) { printf(" will it work?\n"); } printf("it worked.... YEA!\n");
}
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:
- Do it in MASM.
- Modify the C library (take out the hardcoded check). Change the manifest constant ’_KEYBRD_READ’ from 0 to 0x10h hex.
- Make the Int 16h call yourself (do not use _bios_keybrd()) with Int86().
Copyright Microsoft Corporation 1989.