Reading barcodes with Real Studio
Using the SDK with Real Studio on Windows is pretty straight forward and version 7.5.1.6 of the SDK now includes a full example. Anyhow, here’s what you need to do to get barcode reading working with Real Basic…
Step 1.
Download the barcode reader sdk from here
Step 2.
Navigate to where the sdk was installed and open the x86 folder, right click on REGISTER.BAT and select “Run as Administrator”. This will run regsvr32 on SoftekATL.dll – which is the dll you will be using later on.
Step 3:
Open Real Studio and start a new project or open the one you want to use for barcode reading. Click on Project, Add and select “ActiveX Component”
Step 4:
Click on References, scroll down the list and select “SoftekATL X.X.X Type Library”. You will now be able to declare and use objects of type SoftekATL.CBarcode
Step 5:
In the method where you want to read the value of a barcode from an image, add the following code…
Dim oBarcode As SoftekATL.CBarcode oBarcode = New SoftekATL.CBarcode Dim nBarCodes As Integer oBarcode.MultipleRead = 1 oBarcode.ScanBarCode(imagePath) nBarCodes = oBarcode.BarCodeCount For i = 1 To nBarCodes barcodeValue = oBarcode.BarString(i) Next i
Step 6:
That’s it – all done. You might want to add a few more lines of code to control what kind of barcodes you want to read and maybe set a license key:
oBarcode.LicenseKey = "MY LICENSE KEY" oBarcode.ReadCode128 = 1 oBarcode.ReadQRCode = 1 oBarcode.ReadCode25 = 0