实施条形码扫描仪 [英] Implementing bar code scanner

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

问题描述

我正在使用C#在Windows应用程序中实现条形码扫描程序

在一个窗口中,如果光标在扫描代码之后的某处,它必须将扫描数据放入必需的文本框,但它将数据放在焦点存在请帮助我



我尝试过:



对于聚焦文本框,它工作正常

I am implementing Bar code Scanner in Windows Application using C#
In a window if cursor is somewhere after scanning code it has to put the scanned data in Required text Box but it puts data in where the focus exists please kindly help me

What I have tried:

For Focused text box it is working fine

推荐答案

您需要与扫描仪的制造商联系。



大多数扫描仪都设置为模拟键盘 - 因此当您扫描代码时,条形码数据的传输就像在键盘上输入一样。并且Windows不会跟踪键盘数据的来源,如果有两个或更多键盘设备(或键盘模拟设备,Windows不关心),那么数据将按接收顺序送入同一个键盘队列由系统。

这意味着您无法判断是否有任何输入来自扫描仪或用户输入,因此您无法将其指向任何特定控件。



但是,大多数扫描仪可以配置为给出 可以 检测到的特定引入和尾出序列,并在两者之间引导数据他们想要的地方。



但是......每个制造商 - 通常是每个型号 - 都有不同的配置方式,所以你需要联系制造商和了解如何设置序列。
You will need to talk to the manufacturer of your scanner.

Most scanners are shipped set to emulate a keyboard - so when you scan the code, the barcode data is transferred as if it had been typed at the keyboard. And Windows does not keep any track of the source of keyboard data, if there are two or more keyboard devices (or keyboard emulating devices, Windows doesn't care) then the data is fed into the same keyboard queue in the order they are received by the system.
Which means that you cannot tell if any input came from the scanner or from a user typing, and so you can't direct it at any particular control.

However, most scanners can be configured to give specific "lead in" and "tail out" sequences that you can detect, and direct the data between them where you want.

But ... each manufacturer - and often each model - has a different way to configure it, so you will need to contact the manufacturer and find out how to set the sequences.


您可以将条形码扫描器配置为使用回车换行。这与使用键盘手动输入代码然后按enter键相同。然后你可以为keypress / keydown / textchanged创建一个事件并监听ENTER键。自从我开发桌面应用程序以来已经很长时间了,所以我无法回想起要创建的事件..
You can configure your barcode scanner to use "Carriage Return Line Feed". It's the same as if you enter the code manually using your keyboard and then press enter. Then you can create an event for keypress/keydown/textchanged and listen for "ENTER" key. Its been a long time since i developed a desktop application so i can't exactly recall what event to create..


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

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