C++/Barcode Reader detecting in C++
I have a USB Barcode Reader which outputs data on any active application as if it was typed, however i wish to create a C/C++ file that automatically detects the Barcode Reader and from there store the data in a text file, i will worry about the latter but the main question is how can i detect the usb barcode reader?? I have been told C/C++ is the right man for the job, but couldn't find much help online.
Info about the Barcode Reader: Acan (USB), did not come with any CD's, just plugged it in and it worked.
I've interfaced to a bar code reader and can give you some tips I learned during the project. First is that the keyboard input method is very inflexible. You can't have any other edit boxes in the dialog, nor can the edit box you use lose the focus or you'll lose the input. You also cannot have the program as a background program.
The good news is there's a lot better way. Use the reader's driver to get the barcode serially (there should be a driver that loads and converts the USB input to a virtual serial port). Using a serial port allows you to run a task to watch for data and put the data in the desired edit box. The program can run in the background, or, you can bring the program to the top when a scan is detected.
You want to store the data in a text file so the task watching the serial port can simply copy that data to a text file. Although you didn't get a CD I'm sure drivers exist to get the data serially. If not, I'd use one that does because the interface to you program is much easier. I used the least expensice Symbol Technologies Barcode Scanner.
Hope this helps!
[an error occurred while processing this directive]---------- FOLLOW-UP ----------
QUESTION: Hi Bill,
Thanks for that. The problem with my barcode reader is, it is a Acan FG-8100 and it didn't come with a driver instead it's usb and worked straight after plugging it in a usb port. Maybe there is a way to configure all devices that are on that usb port, because i do not mind using the same usb port for that scanner all the time. Or even better maybe there is a universal barcode reader driver?
ANSWER: It looks like you get what you get - for $41 no wonder it has no CD or manual. If you can get to Acan for more information maybe they'll tell you more. I don't know if you can hook into the USB driver and get the data directly. The Symbol scanner was much more (4 times) but was worth it since this was used on as assembly line and the software had to work regardless of the focused control.
---------- FOLLOW-UP ----------
thanks for the answer.
I have had a look at Motorala Symbol scanners and i think the Symbol LS2208 looks like what i am after and i can see that Symbol provide support and software downloads for this scanner unlike Acan. My question is should i get the USB or Serial one or would it not matter as it would come with a driver that i can configure anyway. Also can you advice on the one you got since that one is defenately working and also how you configured it.
You're welcome. LS2208 is what I used - I got the bare model with the stand (which is pretty nice for the money). I think you'll find it better built and of higher quantity than the Acan. I say this knowing the other items I've purchased from DealExtreme, which has great prices but you get what you pay for, as they say.
I got the USB version, which defaults to keyboard entry. You install their USB-Serial driver (one-time) and a virtual COM port comes up. You print a sheet of configuration bar codes (they configure the scanner for various input formats, and interestingly, convert the scanner to serial mode through USB). Open the COM port in Windows and the data comes in just like reading a file. I used a thread to scan. When a scan came in, I called a function that looked up the barcode and populated a few Windows ReadOnly text boxes with the information the user could act on (by just clicking OK when he was ready to process the item). Multiple scans just replaced what was in the text boxes. In your case, you'd write each scan to a file.