[comp.os.msdos.programmer] faking keypresses

kurtenba@parc.xerox.com (Gord Kurtenbach) (09/11/90)

Does anyone know how I can fake keypresses from say a C program? I`m
trying to control a resident program which responds to certain hot
keys (that is takes over control when these keys are hit and
eventually returns control) from my program.  What I would like to do
is from my program queue up a bunch of fake keypresses then let the
resident program run. Is there some way of doing this?

Thanks in advance
Gord

jaa@sppy00.UUCP (Jeff Anderson) (09/12/90)

You can add keys to the keyboard buffer by using Interrupt 16h, function 5h
The function is called with AH = 05h
			    CH = the scan code
			    CL = the character

If AL returns a 1 then the keyboard buffer is full.  
This function works only on IBM AT and compatibles and PS2s with
enhhanced keyboards.

For more information, see Page 499 of the DOS Programmer's Reference (2nt
Edition) by Terry Dettmann


------------------------------------------------------------------------------
Jeff Anderson                                  killer!osu-cis!sppy00!jaa
Online Computer Library Center (OCLC)          unreliable: jaa@sppy00
614-764-6222
------------------------------------------------------------------------------