阅读usb条码扫描仪 [英] read usb barcode scanner

查看:94
本文介绍了阅读usb条码扫描仪的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有一个usb条形码扫描仪,就像一个键盘。它可以轻松扫描条形码,如果记事本打开,它会像键盘一样写出结果。

我想在我用C ++编写的财务应用程序中使用它。我搜索并看到很多网站,但找不到简单的结果。

FYI:

1.条形码扫描仪就像一个键盘,它没有任何功能一个虚拟的COM端口或类似的那样

2.制造商没有任何API或SDK可以使用它

3.我测试了libusb,usb-隐藏图书馆,原始输入,直接输入来自directx和...但没有成功



它似乎很容易,但它太难了。你可以用最简单的方法从中读取数据吗?


I have a usb barcode scanner that acts like a keyboard. It easily scans barcodes and if sth like notepad is open, it writes the result like a keyboard.
I want to use it in my financial application that is written in C++. I searched and saw many websites but couldn't find a simple result.
FYI:
1.the barcode scanner just acts like a keyboard, it has no feature to have a virtual com port or sth like that
2.the manufacturer doesn't have any API or SDK to work with it
3.I've tested libusb , usb-hid libraries, raw input, direct input from directx and ... but no success

It seems to be so easy but it's so hard. can you help me the simplest way to read the data from it?

推荐答案

是的,用它作为键盘。可以对所有扫描仪进行编程,以发出扫描结束组合键。您可以使用它来确定扫描何时发生。



阅读扫描仪的文档,您应该看到如何执行此操作。
Yeah, use it as a keyboard. All scanners can be programmed to send out a "end-of-scan" key combination. You would use that to determine when the scan has occurred.

Read the docs for your scanner and you should see how to do this.

libusb可以直接使用USB HID设备。用libusb驱动程序(inf向导)替换windows HID驱动程序并直接使用它(接收密钥缓冲区)。
libusb can work directly with USB HID device. Replace windows HID driver with libusb driver (inf wizard) and work with it directly (receive key buffers).


这篇关于阅读usb条码扫描仪的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆