Hello

Hello,
does anyone know how to use barcode reader in Delphi?
i have an usb barcode reader that doesn't need drivers or SDK.
Thanks

Comments

  1. Usually these barcode readers emulate keyboard input, so to use it, just read keys.

    ReplyDelete
  2. you need your app to be in the foreground and some TEdit field(or capture OnKeyDown/OnKeyPress) that will grab the "keystrokes" from the barcode reader, start processing the barcode as soon as the VK_RETURN is reached.

    ReplyDelete
  3. thanks for all,
    but the barcode reader post like "$^!::*==" characters in any focused control.

    ReplyDelete
  4. then, implement the logic to find the "end sequence"

    ReplyDelete
  5. That's probably a configuration problem. The ones I know can be configured to send ASCII or binary and use various separator characters. To configure them, the user's manual usually comes with a long list of barcodes that have to be scanned. Don't you have a manual?

    ReplyDelete
  6. i googled and i found hendereds of issues with the same problem i have, unfortunatly there is no tips that resolve this issue!

    ReplyDelete
  7. Thomas Mueller
    no, the device is the owner of one university, and i'm charged by one to make a software for them.

    ReplyDelete
  8. I can't see a simple solution. You could scan known barcodes and then try to decode the input. I would probably tell the owner to go and get me the fuck^d^d^dine manual. Is this some expensive specialized device or just some regular barcode scanner? Hand scanners aren't particularly expensive and it might be much cheaper to buy a new one rather than spending lots of time getting that one to work.

    ReplyDelete
  9. The best way is to try to catch the windows messages in the onapplication message handler without any edit box etc. You also need some encoding/decoding logic from the code page of the barcode reader stream to the encoding of the application (utf 16 ??)

    ReplyDelete
  10. We use Bluetooth and USB scanners, but we use serial port emulation to avoid scan data coming as keystrokes. That way scans can be converted into separate events and queued for processing, parallel to keyboard, touch or mouse processing.

    ReplyDelete
  11. Alternatively, you could - if the scanner allows - add a prefix and postfix character that doesn't naturally exist on a keyboard, which helps isolating scans from keystrokes. The problem is that you still could get random keystrokes in mid-stream.

    ReplyDelete
  12. Dorin Duminica​ not all barcode scanners send a return after the data. Some send a space others a #0 and some nothing at all. It's usually configurable.

    ReplyDelete
  13. I am using an rs232 barcode and it  input from usb or rs port.So first make sure what kind of Barcode reader it is. Usually rs232. Once you know the protocol it is easy. Also the reader can be programmed to baud rate and more

    ReplyDelete
  14. shlomo abuisak he wrote that it adds gibberish to the focused control, so it apparently is working as a keyboard and not a serial device.

    ReplyDelete
  15. Hook on Applicalition.OnMessages. then trim prefix/preamble and postfix/postamble. Only catch WM_CHAR, and look for the prefix. While postfix not found, catch everything, and set hanled to true. You should also use at timer, so that you can exit if the postfix doesn't arrive. Forms should have keypreview=true, otherwise you won't catch return/linefeed.

    ReplyDelete
  16. A potentially simpler way to handle barcode readers is to use OPOS. It does make setting up a new barcode reader a bit more complicated but it shields the application from needing to deal with implementation details of different barcode readers.

    ReplyDelete
  17. Both posts are the correct way to go. If the barcode reader uses keyboard emulation do as Dennis Langthjem​​ says, otherwise use OPOS/JavaPOS as Kenneth Cochran​ suggests. If you can use serial emulation then this is also an option but you should use a serial port component to read data directly from the port

    ReplyDelete
  18. Daniela Osterhagen gibberish mite mean rs232 speed 9600,4800 and so on

    ReplyDelete
  19. Simon Stuart i'm staying your source

    ReplyDelete
  20. shlomo abuisak yes, but not in a focused control. RS232 input doesn't magically appear in the user interface.

    ReplyDelete
  21. Simon Stuart not all of them and with most it's configurable. I've configured one of ours at work to just send the code. It's used to scan serial numbers of sensors into an Excel sheet.

    ReplyDelete
  22. Simon Stuart i"l try and comment you.

    ReplyDelete
  23. Simon Stuart
     The component you gived me doesn't work !, can you make a simple demo and send it to my mail?

    ReplyDelete

Post a Comment