Detect input from barcode reader

Parus

Member
Joined
Feb 25, 2008
Messages
7
Programming Experience
1-3
I am planning to buy a USB barcode reader. I don't want to use it as a keyboard wedge scanner.
But before I do I wonder if it's possible to see whether the input comes from a barcode reader.
I need a Windows Service that detects whether a barcode is scanned and depending on the text on the barcode starts another program.
Is this possible and has anyone experience with this?
 
I'm am currently trying to read data from an USB barcode scanner. I found a handful of libraries online.

So far, I've had the most success with:USB Hid Device Library There are a couple good references at the bottom of his page.

I'll post back any additional information (failures/success).
 
Success!

Using the HIDLibrary I was able to read data directly from the USB port (not as a keyboard wedge or COM port emulation).

Make sure you download the entire library, there is a test container application that you can use to test and tinker with.

The only thing I am not 100% sure (best practice)... when I call "Read" and then scan I get the data from the scanner. If I don't call "Read" again I don't get the data if I scan, when I call read then I get the data. So, after I call read, after I process a read I call "Read" again so it's waiting for the next scan.
 
Addendum

I have been testing the code; but, I ran across an odd problem that some successful scans are not being caught.

I found a C# user components on Code Project:
A USB HID Component for C# that I converted to VB.NET.

It works very well, the current item I'm working on is how to close the connection on the parent form, open it up on a child form and when the child closes, re-open on parent.
 
I have bought the Datalogic Heron G with RS232 emulation, that worked fine for me when I use the visual studio serial port component
 
I have used the RS232 emulator with the product I have; but, this could be a function of the device, in that once the PC is rebooted I have to re-scan a programming barcode for it to reset to use the RS232; by default, it is a keyboard wedge. Do you have the same issue with the Heron G?
 
No, I don't have that issue, once I scanned the barcode for USB-COM emulation the scanner stays programmed like that, even when I connect it to another computer.
Only the chosen COM-port seems to change when I connect the scanner to another pc, but it doesn't change anymore when the computer reboots.
 
Back
Top