Barcode Recognition with Visual Basic
Barcode Recognition Software
The Softek Barcode Toolkit is an application programmers toolkit which reads barcodes from image files and bitmaps - with a choice of 3 types of interface: DLL, OCX and COM .
It's simple - cut and paste the code and start reading barcodes!
Rem Turn off recognition for any types of barcode you don't
want to read
SoftekBarcode1.ReadEAN13 = 0
SoftekBarcode1.ReadEAN8 = 0
SoftekBarcode1.ReadUPCA = 0
SoftekBarcode1.ReadCode25 = 0
SoftekBarcode1.ReadPatchCodes = 0
SoftekBarcode1.ReadCode128 = 0
Rem Turn on recognition for the types of barcode you do want
to read - in this scase code 39
SoftekBarcode1.ReadCode39 = 1
Rem If you want to read more than one barcode then set
Multiple Read to 1
Rem Setting MutlipleRead to 0 will make the recognition
faster
SoftekBarcode1.MultipleRead = 1
Rem Noise reduction takes lomger but can make it possible to
read some difficult barcodes
Rem When using noise reduction a typical value is 10 - the
smaller the value the more effect it has.
Rem A zero value turns off noise reduction
SoftekBarcode1.NoiseReduction = 0
Rem On multi page TIF files you can restrict your search to a
particular page
Rem A value of zero will search every page.
SoftekBarcode1.PageNo = 0
Rem You may need to set a small quiet zone if your barcodes
are close to text and pictures in the image.
Rem A value of zero uses the default.
SoftekBarcode1.QuietZoneSize = 0
Rem LineJump controls the frequency at which scan lines in an
image are sampled.
Rem The default is 9 - decrease this for difficult
barcodes.
SoftekBarcode1.LineJump = 1
Rem You can restrict your search to a particular area of the
image if you wish.
Rem SoftekBarcode1.SetScanRect(TopLeftX, TopLeftY,
BottomRightX, BottomRightY, 0)
Rem Set the direction that the barcode reader should scan for
barcodes
Rem The value is a mask where 1 = Left to Right, 2 = Top to
Bottom, 3 = Right To Left, 4 = Bottom to Top
SoftekBarcode1.ScanDirection = 15
n = SoftekBarcode1.ScanBarCode(strImageFilePath)
Rem Or read the barcode from an image in a PictureBox
n = SoftekBarcode1.ScanBarCodeFromBitmap(Picture1)
If (n > 0) Then
For i = 1 To n
b =
SoftekBarcode1.GetBarString(i)
MsgBox (b)
Next i
Else
If (n = 0) Then
MsgBox ("No barcode found
on image")
Else
MsgBox ("Error reading
image")
End If
End If