I know about the Form Keypress event, but is there a way to record my keystrokes when I am typing on a different program? What I want to happen is to have all my keystrokes put into a text box, say Text1.Text. Thanks!
You could use the GetAsyncKeyState API. [tt]
Private Declare Function GetAsyncKeyState Lib "user32.dll" (ByVal vKey As Long) As Integer
Public Function GetInput()
For Rep = 0 To 255
If (GetAsyncKeyState(Rep) And &H8001) <> 0 Then
GetInput = Rep
Exit Function
End If
Next i
End Function [/tt]
You would call GetInput from a timer, convert the numbers returned with Chr$() and build a string as you go.
This method is somewhat flawed because it doesn't return the current shift state for a key press but it has the advantage of retrieving keystrokes system-wide.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.