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