There is a barcode scanner Winson WNL-5000g-USB . It is necessary to implement a C # (WPF) application in which the lines read by the scanner will be added to the list.

I have never done such a thing and I don’t have a clue how to get my application to catch the scanner at the right moment and show the read barcode. How to catch the string that the scanner reads?

  • Well, I think there should be something like api and work with it - Sasuke
  • I'm not at all in the subject, just google it - tym32167
  • The barcode scanner usually repeats actions from the keyboard. If 123 is written on the barcode, then when reading such a barcode, pressing 123 is generated. In rare cases, it is necessary to divide the scanner separately, the keyboard separately. And still the bar code can be unrecognized - then it needs to be entered from the keyboard. - nick_n_a
  • And if the scanner allowed the input of functional keys, then it would be possible to format c: it at all format c: to sew up the bar code))) - nick_n_a

2 answers 2

Everything turned out to be very simple. This scanner is defined on the computer as a keyboard. I placed the usual TextBox, put the mouse pointer in it and brought the barcode to the scanner. Immediately in the TextBox'e appeared decoded barcode. After some manipulations, I found out that after the scanner scans the bar code, it writes data in the input field where the pointer is set and automatically presses the "Enter" key. And then the matter of technology:

  1. Hover a pointer to a TextBox.
  2. Scan the barcode.
  3. Add the definition of the "Enter" key in the TextBox field. Now, after the barcode has been scanned, an automatic command is invoked that adds the barcode to the list.
  4. We update the list and see our barcode in it.

    A diploma last year wrote and just used them at work. Scanners have three types of connections:

    RS-232

    The data will be transmitted to the serial port in the form of ASCII characters. We look how to work with COM ports.

    USB-COM (USB-RS)

    Two options: RS-232 emulation or transfer to the port of ASCII-characters (it depends on the manufacturer). Firewood or api will be needed.

    USB (keyboard break) or PS / 2

    Just simulates keystrokes on a keyboard. We put the focus on the input form, scan and the code will be in line. Note that the result may depend on the keyboard layout.

    • I already found this information, thanks. I had a scanner simulating keystrokes. - Leksor