Are you using USB Bar Code scanners to input data into a Xojo application?
Then you are probably struggling with the fact that the scanner simulates typing on the keyboard, and you have to figure out how to tell the scanner input data apart from actual typing.
But there may be a better solution. At least with the GoDEX GS550 (admittedly not the cheapest scanner but I am sure most other scanners support this mode as well because it's a USB standard for scanners), it is possible to configure it so that it doesn't send keyboard strokes but transmits the data over a separate "HID" USB channel. To receive such data, you can install a USB HID handler for the device while your OSX app runs, and then you can receive the data from the scanner cleanly and distinctly, no matter in which state you app is, even if it's in the background.
To make this work you will need some of the MBS plugins, though. Though you may be able to do this all with declares, it's just not worth the effort for me.
I've uploaded a demo project here: http://files.tempel.org/RB/HID_Bar_Code_Scanner_Demo.rbp.zip
See the instructions in the "About" Note inside the module.