截取条形码扫描仪,完成时将焦点传递给应用程序? [英] Intercept Barcode Scanner, Pass to Application with Focus When Done?

查看:138
本文介绍了截取条形码扫描仪,完成时将焦点传递给应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法拦截USB条码扫描器输入,利用它,然后将其传递给有焦点的应用程序?

Is there a way to intercept USB Barcode Scanner input, utilize it, then pass it on to the application that has focus?

我们目前使用条形码扫描仪加载订单装运信息到Endicia和FedEx。当这些应用程序启动时,查找字段将获得焦点。扫描条形码时,文本将传递到字段中,然后这些应用程序会查找其余的客户信息。这个过程很有效。

We currently use Barcode scanners load order shipment information into Endicia and FedEx. When those applications start up, the lookup field is given focus. When you scan a barcode, the text is passed into the field, and then those applications look up the rest of the customer information. This process works great.

现在我们试图通过比较实际订单权重与应该的数量来限制选择错误。为了实时这样做,我需要拦截扫描仪输入并使用它检查数据库中计算出的重量与实际比例重量。如果它显着偏离,我想显示一条警告信息。

Now we are trying to limit pick errors by comparing the actual order weight with what it should be. In order to do this real-time, I need to intercept the scanner input and use it check the calculated weight in the database against the actual scale weight. If it is off by a significant margin I want to display a warning message.

我还需要能够将条形码传回原始字段中的正确字段具有焦点的应用程序,以便它可以查找货件数据。

I also need to be able to then pass the barcode back to the correct field in the original application that had focus so it can look up the shipment data.

有没有人做过这样的事情?你能指点一些拦截输入的资源然后把它冒回到有焦点的字段吗?

Has anyone done something like this? Can you point me to some resources on intercepting input then bubbling it back up to the field that had focus?

注意:这是在Windows环境中。我最熟悉C#,但是VB.net也可以工作。

Note: This is in a Windows environment. I'm most familiar with C#, but VB.net would also work.

推荐答案

对于计算机,条形码扫描仪只是像键盘,没有键。扫描条形码时,扫描仪会将条形码转换为键盘输入。要在第二个程序中捕获输入,您需要使用键盘钩子。

To a computer, a barcode scanner is just like a keyboard, without the keys. When you scan a barcode, the scanner converts the barcode into keyboard input. In order to capture the input in a second program, you'd need to use a keyboard hook.

看看这个项目这个项目。您可以制作一个使用其中一个键盘钩子的程序,并且您使用条形码扫描仪扫描的任何数据也将被路由到您的程序。

Look at this project and this project. You can make a program that uses one of these keyboard hooks and any data you scan with your barcode scanner will get routed to your program too.

这篇关于截取条形码扫描仪,完成时将焦点传递给应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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