Simulates keystrokes using keybd_event

Category:
System/API
Type:
Classes
Difficulty:
Intermediate
Author:
Scott Seligman

Version Compatibility: Visual Basic 5

More information:
This class simulates keystrokes using the keybd_event API. If offers two advantages over SendKeys. First, it doesn't cause the num lock light to flicker unless you specifically press the num lock key. Secondly, it's possible to press and hold a key. Sample Usage: Dim keys As New clsKeys Dim bCapsLock As Boolean keys.GetLockStatus bCapsLock, True, True If bCapsLock Then keys.PressKeyVK keyCapsLock End If keys.PressString "Now is the time for all good men to come to " & _ "the aid of their country."

Instructions: Click the link below to download the code. Select 'Save' from the IE popup dialog. Once downloaded, open the .zip file from your local drive using WinZip or a comparable program to view the contents.

Download clskeyboard.zip