Microsoft KB Archive/36325: Difference between revisions
m (Text replacement - "<" to "<") |
m (X010 moved page Microsoft KB Archive/Q36325 to Microsoft KB Archive/36325 without leaving a redirect: Text replacement - "Microsoft KB Archive/Q" to "Microsoft KB Archive/") |
||
(One intermediate revision by the same user not shown) | |||
Line 15: | Line 15: | ||
The following code demonstrates this problem: | The following code demonstrates this problem: | ||
#include <stdio.h | #include <stdio.h> #include <bios.h> #include <conio.h> void main(void); | ||
void main() { unsigned service; | void main() { unsigned service; |
Latest revision as of 19:21, 12 August 2020
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.