RS232 barcode scanners are starting to be a thing of the past because of new USB and keyboard wedge scanners. RS232 barcode scanners work very well in applications but their implementation in an application is complicated as it requires accessing the RS232 API among other complications.
On the other hand, USB and keyboard wedge scanners are very easy to use. The barcode scanners we resell and recommend all have built in decoders that can read several barcode types and send them via the keyboard so information scanned appears as if it had been typed. This type of implementation does not require any complicated API like the RS232 scanner requires. There are several easy methods of automating your applications with input from keyboard wedge or USB scanners. Here are just a few of them:
Scan data into the field on the form:
This is the simplest of all implementations. To scan a barcode all you have to do is place the cursor on a field in a form and scan the barcode. This process can be automated to include tabs and returns with our Code 39 and Code 128 barcode products - even in web browsers and custom operating systems. By using tabs and returns, a single barcode can enter data in one field, tab to another, enter more data and choose the default button (a return). Information about encoding tabs and returns into barcodes is available in our Code 39 FAQ and the Code 128 FAQ.
Program the application to monitor for specific characters that trigger an operation:
With this implementation, the cursor can be anywhere on the form. You program your application to respond to a specific character that is not frequently used. In this example, we use Visual Basic 6 to respond to the tilde "~" character. However, you can program to respond to any character that is not used in the application.
To implement this in Visual Basic, you first need to set KeyPreview to True so the scanned data can be evaluated:
Private Sub Form_Load() Scanner_Activation_Form.KeyPreview = True End Sub
Then we simply place code in the form that will respond to the specific character when it is scanned. ASCII 126 (the tilde key) is used to start the process in this example. The tilde key can also be entered from the keyboard to manually start the process.
Private Sub Form_KeyPress(KeyAscii As Integer) If KeyAscii = 126 Then KeyAscii = 0 ScannedData.Text = InputBox("Enter Data:") End If End Sub
After the data is scanned into the text box, the return function in the barcode chooses the "OK" button and the data is entered into the text box. We could also perform other functions such as a database lookup.
You can test this application yourself if you have VB 6 and a barcode scanner. We have included the VB source code in this application for your convenience. Download the application here and scan the barcodes below:
Code 128 barcode:
How created: Enter ~TESTDATAÆm
into the code 128 character set B selection of any of our barcode
components or font
automation tools.
Code 39 barcode:
How created: Enter %STESTDATA$M
into any of our barcode components
or font automation tools.
When using the barcode font you may enter *%STESTDATA$M*.
Extended code 39 must be enabled in your scanner for the tilde and
return function to work.
View our product index to obtain a list of all products we offer.
Quick Links: [IDAutomation.com Home | Fonts | ActiveX | Java | Scanners] |
Copyright © 2002 IDAutomation.com, Inc. All rights reserved. All trademarks mentioned are the property of their respective owners. These examples are provided as-is with no warranty or guarantee. IDAutomation.com cannot support or troubleshoot problems you may have with custom source code.