Results 1 to 3 of 3

Thread: To Capture all the Keys

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Oct 2001
    Location
    India
    Posts
    20

    Thumbs up To Capture all the Keys

    I am working in a windows platform, i wanted to start capturing all the keys pressed along with its application name when the window starts up till it is shut down
    Last edited by Vivaj; Mar 4th, 2002 at 02:24 AM.

  2. #2
    Frenzied Member MerrionComputin's Avatar
    Join Date
    Apr 2001
    Location
    Dublin, Ireland
    Posts
    1,616
    In Windows NT/2000/XP you can do this by installing a WH_KEYBOARD_LL hook.

    To do this with the EventVB.dll:

    Code:
    ' Form declarations
    Private WithEvents apiLink As EventVB.ApiFunctions
    Private WithEvents hook As EventVB.EnumHandler 
    
    ' Form load
    Private Sub Form_Load()
      Set apiLink = New EventVb.ApiFunctions
      Set hook = apiLink.EventHandlerLink
    
      hook.StartHook WH_KEYBOARD_LL,apiLink.AppModuleHandle, 0
    
    End Sub
    
    ' Form unload
    Private Sub Form_Unload(Cancel As Integer)
       hook.StopHook WH_KEYBOARD_LL
    End Sub
    
    Private Sub hook_HOOKPROCKEYBOARDLL(Action As EventVB.enHookCode, ByVal KeyState As Long, ByVal KeyStrokeInfo As EventVB.ApiKBDLLHOOKSTRUCT, lMsgRet As Long)
    
    With KeyStrokeInfo
        Debug.Print .vKey
    End With
    
    End Sub

    HTH,
    Duncan
    ----8<---------------------------------------
    NEW - The .NET printer queue monitor component
    ----8<---------------------------------------
    Now with Examples of use

  3. #3

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