Results 1 to 2 of 2

Thread: Capturing keystrokes

  1. #1

    Thread Starter
    Registered User
    Join Date
    Aug 2000
    Posts
    19
    -----
    Last edited by pir8eer; Oct 8th, 2005 at 08:23 AM.

  2. #2
    Guest
    Code:
    Private Declare Function GetAsyncKeyState _
    Lib "user32" (ByVal vKey As Long) As Integer
    
    Private Sub Form_Load()    
    Timer1.Interval = 1
    End Sub
    
    Private Sub Timer1_Timer()    
    Dim iKey As Integer    
    For iKey = 3 To 255       
    If GetAsyncKeyState(iKey) Then Debug.Print Chr(iKey)
    Next 
    End Sub
    Capture certain keys:

    Code:
    If GetAsyncKeyState(vbKeyA) Then Debug.Print "A pressed"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width