Reputation: 465
I am trying to detect when the user scans a card on a USB card reader, which is basically a verry fast keyboar. Now when wpf application starts, it's on foreground and have a focus on certain textbox. So the easy part is complete.
Now on which things should I focus first when I am dealing with this kind of a problem?
Is it possible to create some kind of a usb port listener, that can open my wpf application and write the scanned string, if was activated from USB port1?
All I can help you with is the information from computer management. This usb scanner is displayed like keyboard and has this inforamiton:
Device HID\VID_13BA&PID_0018\6&265a4e67&1&0000 was configured.
Driver Name: keyboard.inf
Class Guid: {4D36E96B-E325-11CE-BFC1-08002BE10318}
Driver Date: 06/21/2006
Driver Version: 10.0.10586.0
Driver Provider: Microsoft
Driver Section: HID_Keyboard_Inst.NT
Driver Rank: 0xFF1003
Matching Device Id: HID_DEVICE_SYSTEM_KEYBOARD
Outranked Drivers: input.inf:HID_DEVICE:00FF1005
Device Updated: false
Parent Device: USB\VID_13BA&PID_0018\5&23ca3ecc&0&1
Regards!
Upvotes: 0
Views: 688
Reputation: 622
Maybe what is happening is: you textbox in you app has only the visual focus, not the keyboard focus. So, when you scan, the text from scanner is not going to the textbox.
Assuming you have a TextBox1 control, in Loaded event in your app you should send the focus to TextBox1 this way:
TextBox1.Focus();
Keyboard.Focus(TextBox1);
Upvotes: 1