Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sending keyboard events

Status
Not open for further replies.

lordhuh

Programmer
Apr 25, 2000
96
US
is there an api that will alow me to emulate keyboard presses at the windows level. i am going to be reading from a serial device and when i get a certain condition i want to be able to have my program type something to what ever window has focus (outside my program too). let me know if any of you know a way or where to find more info about api's.

-karl Karl Pietri
 
This is exactly what you are looking for:

Public Declare Sub keybd_event Lib "user32" Alias "keybd_event" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)

bVk
Specifies a virtual-key code. The code must be a value in the range 1 to 254. For a complete list, see Virtual-Key Codes.

bScan
This parameter is not used.

dwFlags
Specifies various aspects of function operation. This parameter can be one or more of the following values.

KEYEVENTF_EXTENDEDKEY:
If specified, the scan code was preceded by a prefix byte having the value 0xE0 (224).
KEYEVENTF_KEYUP:
If specified, the key is being released. If not specified, the key is being depressed.

dwExtraInfo
Specifies an additional value associated with the key stroke.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top