Distinguish between Keyboard and basic Barcode Scanner
-
Hi, Does someone know if it is possible to know if characters that was received, was received from the Keyboard or from the Barcode scanner? Thanks X|
If your scanner is like ours, then no. I would suggest you try asking the manufacturers of the scanner.
-
Hi, Does someone know if it is possible to know if characters that was received, was received from the Keyboard or from the Barcode scanner? Thanks X|
I am in need of the same thing. We use symbol scanners and I know that I read somewhere that most manufactures have a dll file to integrate with your applications. This hasnt been something I have looked into yet but will be very shortly. Can you let me know if you find out something, or maybe we can help each other complete this?
-
Hi, Does someone know if it is possible to know if characters that was received, was received from the Keyboard or from the Barcode scanner? Thanks X|
-
Hi, Does someone know if it is possible to know if characters that was received, was received from the Keyboard or from the Barcode scanner? Thanks X|
If it's a keyboard wedge scanner, then no, there's no way to tell. Though, most scanners will let you setup a preamble/postamble sequence that the scanner pre-/post-pends to the data it "types", like adding "@@" to the string. So, if you scan a barcode of "123456789", the scanner actually sends "@@123456789". How I've done it in the past is to set my form's KeyPreview to True, and in the KeyDown event of the form, I look for the "@" character (in this example). If I keep getting the preamble sequence, then I know the next numbers I get are for the barcode and I redirect that data appropriately.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008 -
I am in need of the same thing. We use symbol scanners and I know that I read somewhere that most manufactures have a dll file to integrate with your applications. This hasnt been something I have looked into yet but will be very shortly. Can you let me know if you find out something, or maybe we can help each other complete this?
-
Brad, Did you see the comment from Dave Kreskowiak, i think this will work. Your scnner should come with a form containing different bar codes. These are used to configure the scanner. Cheers
Yes I saw that, and I think that is what I am going to do. I wish I did not have to do this as I like the barcode application to send just the barcode so it can work with other things I have but appears to be the only choice. I use the POS-X Xi3000 ( http://www.posguys.com/barcode-scanner\_3/POS-X-Xi3000\_716/XI3000U\_9177/\[[^](http://www.posguys.com/barcode-scanner_3/POS-X-Xi3000_716/XI3000U_9177/ "New Window")] ) which is a great scanner, but I wish they had the ability to capture the scanner just like Symbol does.
-
If it's a keyboard wedge scanner, then no, there's no way to tell. Though, most scanners will let you setup a preamble/postamble sequence that the scanner pre-/post-pends to the data it "types", like adding "@@" to the string. So, if you scan a barcode of "123456789", the scanner actually sends "@@123456789". How I've done it in the past is to set my form's KeyPreview to True, and in the KeyDown event of the form, I look for the "@" character (in this example). If I keep getting the preamble sequence, then I know the next numbers I get are for the barcode and I redirect that data appropriately.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008I am trying to figure out the best way to integrate this so that it can be customizable. My barcodes are always 12 characters long but you never know what might change in the future. So my thought is to look for two @@ which means were starting the barcode and then two @@ means the barcode has ended. I have activated the forms keypreview so I can now watch the keys on KeyPress. The problem I am having is trying to figure out the best way to make this dynamic and customizable by a config file incase the user wants to use three #'s instead of @.
// First we set the config variables as to what the barcode variables will be private static string ConfigBarcodePreSuffix = "@"; private static int ConfigBarcodePreSuffixTimes = 2; // Set the form variables so we can capture whats going on private static string Scanned_BarcodeText = ""; // Will hold the final barcode value private static bool Scanned_BarcodeBeingScanned = false; // Will hold a bool value so we know we scanning the barcode private static int Scanned_PreSuffixFoundTimes = 0; // How many times have we found this presuffix private void frmEventTicketVerify_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar.Equals(ConfigBarcodePreSuffix)) { // This is the character were looking for so lets find out if its the start or end if (!Scanned_BarcodeBeingScanned) { // We have not started scanning the barcode so lets see if we hit it if (Scanned_PreSuffixFoundTimes == ConfigBarcodePreSuffixTimes) { // This is how many times they are looking for the prefix so lets start the barcode Scanned_BarcodeBeingScanned = true; } } else { // This is the ending of the barcode if (Scanned_PreSuffixFoundTimes == ConfigBarcodePreSuffixTimes) { // This is how many times they are looking for the prefix so lets start the barcode Scanned_BarcodeBeingScanned = false; } } // Move the prefix count up Scanned_PreSuffixFoundTimes++; } else { // This wasnt the key we were looking for so lets reset it Scanned_PreSuffixFoundTimes = 0; } if (Scanned_BarcodeBeingScanned) { // We are still inserting text from the barcode, so lets continue to add it Scanned_BarcodeText += e.KeyChar.ToString(); } else if (!Scanned_BarcodeText.Trim().E
-
I am trying to figure out the best way to integrate this so that it can be customizable. My barcodes are always 12 characters long but you never know what might change in the future. So my thought is to look for two @@ which means were starting the barcode and then two @@ means the barcode has ended. I have activated the forms keypreview so I can now watch the keys on KeyPress. The problem I am having is trying to figure out the best way to make this dynamic and customizable by a config file incase the user wants to use three #'s instead of @.
// First we set the config variables as to what the barcode variables will be private static string ConfigBarcodePreSuffix = "@"; private static int ConfigBarcodePreSuffixTimes = 2; // Set the form variables so we can capture whats going on private static string Scanned_BarcodeText = ""; // Will hold the final barcode value private static bool Scanned_BarcodeBeingScanned = false; // Will hold a bool value so we know we scanning the barcode private static int Scanned_PreSuffixFoundTimes = 0; // How many times have we found this presuffix private void frmEventTicketVerify_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar.Equals(ConfigBarcodePreSuffix)) { // This is the character were looking for so lets find out if its the start or end if (!Scanned_BarcodeBeingScanned) { // We have not started scanning the barcode so lets see if we hit it if (Scanned_PreSuffixFoundTimes == ConfigBarcodePreSuffixTimes) { // This is how many times they are looking for the prefix so lets start the barcode Scanned_BarcodeBeingScanned = true; } } else { // This is the ending of the barcode if (Scanned_PreSuffixFoundTimes == ConfigBarcodePreSuffixTimes) { // This is how many times they are looking for the prefix so lets start the barcode Scanned_BarcodeBeingScanned = false; } } // Move the prefix count up Scanned_PreSuffixFoundTimes++; } else { // This wasnt the key we were looking for so lets reset it Scanned_PreSuffixFoundTimes = 0; } if (Scanned_BarcodeBeingScanned) { // We are still inserting text from the barcode, so lets continue to add it Scanned_BarcodeText += e.KeyChar.ToString(); } else if (!Scanned_BarcodeText.Trim().E
Well, I didn't do much beyond glancing at the code, but I can tell you you're going about this wrong. The prefix can be any combination of characters (usually - depends on the barcode scanner) and doesn't have to be the same character repeating. On top of that, it's not a good idea to use the same combination of chracters for the pre and postambles. You won't be able to tell the difference between the start and stop combinations.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008