Inserting+characters+into+the+keyboard+buffer

//by Richard Russell, July 2006//

On the //BBC Microcomputer// and some other Acorn computers you could insert a character into the keyboard buffer using the ***FX 138** command. For example the following code would insert the character "R" (CHR$82) into the keyboard buffer:

code format="bb4w" *FX138,0,82 code //BBC BASIC for Windows// doesn't have a directly equivalent command, but you can achieve the same effect using the following procedure:

code format="bb4w" DEF PROCfx138(C%) WM_CHAR = 258 SYS "PostMessage", @hwnd%, WM_CHAR, C%, 0 ENDPROC code So to insert the character "R" into the keyboard buffer you would do:

code format="bb4w" PROCfx138(82) code or, equivalently,

code format="bb4w" PROCfx138(ASC("R")) code