Results 1 to 3 of 3

Thread: Global Keystrokes Capturing

  1. #1

    Thread Starter
    Addicted Member ShIzO's Avatar
    Join Date
    Apr 1999
    Location
    Bartlett, IL
    Posts
    189

    Post

    does anyone know how to capture keystrokes globally. What i mean Globally is that anything that is being typed on the computer, not only in my application. For example, capture the keys when typing something in the MS Word or anything else.

    I just want to be able to send these keystrokes to my application but still be able to use other programs without any problems.

    Please help!

  2. #2
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,177

    Post

    You can use the GetAsyncKeyState API with the Timer Control to Monitor the Virtual Key Codes activated from any Application, eg.
    Code:
    Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
    
    Private Sub Form_Load()
        Timer1.Interval = 100
    End Sub
    
    Private Sub Timer1_Timer()
        Dim iKey As Integer
        For iKey = 0 To 255
            If GetAsyncKeyState(iKey) Then Caption = "Virtual KeyCode: " & iKey & " was pressed."
        Next
    End Sub

    ------------------
    Aaron Young
    Analyst Programmer
    [email protected]
    [email protected]

  3. #3
    New Member
    Join Date
    Feb 2000
    Location
    Klongkum,Bungkum Bangkok
    Posts
    4

    Post

    Thanks. I think that really helps alot.

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