What I did was use KeyPreview to monitor for a function key, such as F9, for which the barcode scanner is set to prefix scanning. When this is received, I will open a dialog with one edit box and an OK button. Then it receives the rest of the barcode information, and the scanner finishes recording with the Enter key. Then I can determine the purpose of the scanned data (in my case, one type begins with a prefix), and then puts the data in the corresponding field in my main form.
I chose F9 because it seems to be inert in most applications, so you can use the scanner in other ways, but I support other keys for flexibility. My application also has a scanner verification mode, where it shows the keys sent.
source share