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
does anyone know how to use barcode reader in Delphi?
i have an usb barcode reader that doesn't need drivers or SDK.
Thanks
Usually these barcode readers emulate keyboard input, so to use it, just read keys.
ReplyDeleteyou 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.
ReplyDeletethanks for all,
ReplyDeletebut the barcode reader post like "$^!::*==" characters in any focused control.
then, implement the logic to find the "end sequence"
ReplyDeleteThat'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?
ReplyDeletei googled and i found hendereds of issues with the same problem i have, unfortunatly there is no tips that resolve this issue!
ReplyDeleteThomas Mueller
ReplyDeleteno, the device is the owner of one university, and i'm charged by one to make a software for them.
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.
ReplyDeleteThe 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 ??)
ReplyDeleteWe 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.
ReplyDeleteAlternatively, 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.
ReplyDeleteDorin 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.
ReplyDeletemodel of barcode?
ReplyDeleteI 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
ReplyDeleteshlomo abuisak he wrote that it adds gibberish to the focused control, so it apparently is working as a keyboard and not a serial device.
ReplyDeleteHook 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.
ReplyDeleteA 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.
ReplyDeleteBoth 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
ReplyDeleteDaniela Osterhagen gibberish mite mean rs232 speed 9600,4800 and so on
ReplyDeleteSimon Stuart thanks a lot,
ReplyDeleteSimon Stuart i'm staying your source
ReplyDeleteshlomo abuisak yes, but not in a focused control. RS232 input doesn't magically appear in the user interface.
ReplyDeleteSimon 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.
ReplyDeleteSimon Stuart i"l try and comment you.
ReplyDeleteSimon Stuart
ReplyDeleteThe component you gived me doesn't work !, can you make a simple demo and send it to my mail?