>I am trying to write an app which uses serial barcode input as opposed to keyboard wedge input. The problem which i have is that the data is received from the scanner and is buffered, so when loaded into a variable, sometimes not all of the barcode string is read in, causing a validation error. Does anyone know how to reliably wait for the reader to finish, bearing in mind there is no stop digit and the barcodes are variable length?
All the barcode readers I've seen allow you to set a post-barcode character, usually either chr(13) or chr(32) (I think that's the space). Poll the buffer for that character, and take a substring of the buffered data up to (and including) the final character, returning the remainder of the string to the buffer. If the final character isn't in the buffer, the program should wait and re-poll.
When MSCOMM32 reads the input, tell it to ADD to the buffer not REPLACE the buffer. That way you keep adding data as MSCOMM32 wishes, but subtracting 'whole' barcodes.