Determining where keystroke input comes from

  • Thread starter Thread starter Jim Franklin
  • Start date Start date
J

Jim Franklin

Hi,

Can anyone tell me if it is possible to determine which device is being used
when I have two input devices? I have an Access 2003 app being used on a
Windows XP pc with a magnetic key reader which sends a number of keystrokes
to the app when a key is tapped on it (the sort of thing barstaff use at the
till in pubs & clubs etc.)

Can anyone tell me if there is any way of differentiating these keystrokes
from those sent by the normal keyboard? Possibly port numbers or anything?

Thanks for any help anyone can provide,

Jim
 
hi Jim,

Jim said:
Can anyone tell me if it is possible to determine which device is being used
when I have two input devices?
Yes, it's possible. But it is really hardcore system programming which
needs imho a kernel driver to intercept the messages.
I have an Access 2003 app being used on a
Windows XP pc with a magnetic key reader which sends a number of keystrokes
to the app when a key is tapped on it (the sort of thing barstaff use at the
till in pubs & clubs etc.)
Why do you need to know that?

You can configure most readers to append an extra start and stop
character, eg. STX/ETX. You can use these as criteria in your
application using the Key Press event and Key Preview, e.g. from a
barcode scanner:


Option Compare Database
Option Explicit

Private m_BarcodeScanning As Boolean
Private m_BarcodeString As String

Public Sub Barcode(ABarcode As String)
' Do Barcode Magic Here:

txtBarCode.Value = ABarcode

End Sub

Private Sub Form_Current()

m_BarcodeScanning = False

End Sub

Private Sub Form_KeyPress(KeyAscii As Integer)

On Local Error GoTo LocalError

' Start Transmission STX
If KeyAscii = 2 Then
KeyAscii = 0
m_BarcodeScanning = True
m_BarcodeString = ""
End If

' End Transmission ETX
If KeyAscii = 3 Then
KeyAscii = 0
m_BarcodeScanning = False
' Weiterbearbeitung
Barcode m_BarcodeString
End If

If m_BarcodeScanning And (KeyAscii > 0) Then
m_BarcodeString = m_BarcodeString & Chr$(KeyAscii)
KeyAscii = 0
End If

Exit Sub

LocalError:
m_BarcodeScanning = False
m_BarcodeString = ""

End Sub

mfG
--> stefan <--
 
Back
Top