[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 522
  • Last Modified:

USB Scanner on Windows.Forms

Hello
I need to add a Barcodescanner to my application. The scanner is connected over a USB and behaves like a second keyboard.

As soon as a barcode is scanned, I want to open a new dialog and enter the read string into a textbox. This should happen, independed on which control of my application the focus is at the moment of the scan. (I can add a control-char at the beginning of the scann)
What is an easy way to do this?

I still use .NET 1.1 on Win XP

0
ICSAutomation
Asked:
ICSAutomation
  • 4
  • 2
  • 2
1 Solution
 
Ariful AmbiaHead of ITCommented:
you need Processing Keyboard Hooking

http://www.codeproject.com/KB/cs/globalhook.aspx
0
 
mcs0506Commented:
HI,

The USB bar code scanner is act like keyboard so you can do for scanning
1: Make sure when you want to scan focus must be in textbox (when focus is in textbox then all the is  written like keyboard )
2: Last character of code string is Enter key so you can check  this char in any event Like KeyPress,KeyDown etc. where you can display dialog box.

Regards

Dani
0
 
ICSAutomationAuthor Commented:
@mcs0506
I don't have the focus on a specific control/textbox. When I detect a scan, I want to open a new form first and the put the scan-string into a certain textbox of this new form.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
mcs0506Commented:
you can scan first on previous form in hidden textbox after scanning you can go to the next form by using textbox event and if you any public string type variable in 2nd form then assign barcode string to that string variable before showing the 2nd form then in 2nd form you have barcode to use.

Regards

Dani
0
 
mcs0506Commented:
Or 0ne more option is there


Create a button Like Scan on First form when Scan button is clicked then show the 2nd form and onload set focus to that text box where you want and then perform acual scanning through barcode scanner.



Dani

0
 
ICSAutomationAuthor Commented:
@mcs0506
I'm looking for a solution where the scan creates an Event. I don't want to press a button first or want to be in a cetain control.

In every moment when a scan is done (doesn't matter what I'm doing in my application) the scecond form should open and the scan has to be read.
0
 
mcs0506Commented:
use my first comments

you can add textbox on 1st form as hidden textbox, make focus on that textbox after scanning you can go to the next form by using textbox event and if you any public string type variable in 2nd form then assign barcode string to that string variable before showing the 2nd form then in 2nd form you have barcode to use.
0
 
Ariful AmbiaHead of ITCommented:
Keyboard hooking is only way how u can have a event when a scan taking place. All u have to do is if the data pattern found by hooking match barcode pattern open your window and show the scanned data
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 4
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now