Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
Article Q50944
◄Contents► ◄Index► ◄Back►
─────────────────────────────────────────────────────────────────────────────
◄Knowledge Base Contents► ◄Knowledge Base Index►
Using CALL INTERRUPT to Push Characters into Keyboard Buffer - Q50944
It is possible in Visual Basic for MS-DOS to push keys into the
keyboard buffer on IBM AT and PS/2 class computers using the
CALL INTERRUPT statement. (This technique will not work on IBM PC
class computers.) This can allow you to create keyboard macros, such
as for training and demonstration sequences in a program. Therefore,
if you were to write a program that required a lot of input from and
interaction with a user, you could also write a training or
demonstration sequence that would show the user what kind of input
your program required, using the method demonstrated below. This
would require filling in the required responses for the user by
pushing the keystrokes into the keyboard buffer.
More Information:
The interrupt for the key push routine requires both the scan code for
the key and the ASCII value of the character to be pushed. A maximum
of 15 characters can be pushed into the keyboard buffer at one time.
The example program below, KEYPSH.BAS, sets up a table containing all of
the scan codes for ASCII character values 32 (a space) through 126
(~), and defines the routine PUSHSTRING that will push the passed
string of characters into the keyboard buffer.
◄See Example►
Keyboard scan codes and ASCII codes are documented in Appendix A of
"Microsoft Visual Basic for MS-DOS Language Reference".