条码扫描器应用程序 [英] barcode scanner application

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

问题描述

我想构建一个从手持条码扫描器读取数据的应用程序,但我希望它在后台运行(最小化窗口)。



如何制作我的应用程序从扫描仪读取数据而不中断前台的应用程序或者没有扫描仪的数据也被发送到活动窗口?

解决方案

这不容易 - 一点也不容易。存在一些问题:大多数扫描仪被配置为充当键盘,因此条形码数据变为活动形式,就好像它是键盘数据一样,并且很难转移。有可能将扫描仪配置为发送前缀和后缀代码,将数据标识为条形码,但要做到这一点,您需要与制造商交谈,因为没有标准方法可以做到所有制造商使用的。



完成后,你需要做一下硬盘:全局挂钩。而且你不能在.NET中这样做,所以你必须与本机应用程序(或进程)进行交互才能做到这一点 - 如果出现任何问题,这会使你的系统不稳定。但是这里有一些很好的艺术品:

使用C#处理全局鼠标和键盘挂钩 [ ^ ]

.NET中的全局系统挂钩 [ ^ ]



祝你好运 - 这不是一个简单的任务,形式或形式!

I want to build an application to read data from handheld barcode scanner but I want this to run in the background (minimized window).

How to make my application reads the data from scanner without interrupting the applications in the foreground or without the data from the scanner to be send to the active window as well?

解决方案

That's not easy - not easy at all. There are a couple of problems: most scanners are configured to act as a keyboard, so the barcode data goes to the active form as if it was keyboard data, and that is very hard to divert. It may be possible to configure the scanner to send a prefix and suffix code which identifies the data as a barcode but to do that you need to talk to teh manufacturer as there is no standard way to do that which all makers use.

Once you have done that, you need to do the hard bit: global hooking. And you can't do that in .NET, so you have to interface with a native application (or process) to do that - which can leave your system unstable in my experience if anything fails. But there are a couple of good artciles on it here:
Processing Global Mouse and Keyboard Hooks in C#[^]
Global System Hooks in .NET[^]

Good luck - this is not a trivial task in any way, shape or form!


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

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