Microsoft KB Archive/66744

= How to POKE Keystrokes Such as F3 (Last Command) into Keyboard =

Article ID: 66744

Article Last Modified on 8/16/2005

-

APPLIES TO


 * Microsoft QuickBasic 4.0
 * Microsoft QuickBASIC 4.0b
 * Microsoft QuickBasic 4.5 for MS-DOS
 * Microsoft BASIC Compiler 6.0
 * Microsoft BASIC Compiler 6.0b
 * Microsoft BASIC Professional Development System 7.0
 * Microsoft BASIC Professional Development System 7.1

-



This article was previously published under Q66744



SUMMARY
Instead of using CALL INTERRUPT to push keystrokes into the keyboard buffer, the code example below POKEs a key directly into the keyboard buffer area in memory under MS-DOS.

This information applies to QuickBasic versions 3.0, 4.0, 4.0b, and 4.5 for MS-DOS; to Microsoft Basic Compiler versions 6.0 and 6.0b for MS-DOS; and to Microsoft Basic Professional Development System (PDS) versions 7.0 and 7.1 for MS-DOS.



MORE INFORMATION
In many applications, it is often useful to echo the command line to the screen during repetitive execution of a program. This makes the program easier to use by allowing you to avoid typing in the command line at the completion of each instance of the program. The code example below shows a quick way to push the F3 keystroke into the keyboard buffer, which echoes the previously entered command line to the screen.

Code Example
DEF SEG = 0     ' Set default segment to 0 POKE 1054,0     ' Push 0 for extended key into keyboard buffer POKE 1055, 61   ' Push F3 key scan code into keyboard buffer POKE 1050, 30   ' Set beginning (head) buffer position POKE 1152, 32   ' Set ending (tail) buffer position DEF SEG         ' Return current segment pointer to default segment

