Barcode Methods for OCX , DLL

GetBarString

 

GetBarString(n) 
barstring(n) (COM Object only)

GetBarString retrieves a barcode string that has been detected by the ScanBarCode method.

n is the index to the barcode string to be retrieved and is indexed from 1.

The following strings can be returned for patch codes - "Type I", "Type II", "Type III", "Type IV", "Type VI" and "Type T".

Visual Basic using the OCX

[form.]SoftekBarcode.GetBarString (n)

Visual Basic using the DLL

Private Declare Function stGetBarString Lib "SoftekBarcode" (ByVal nBarCode As Integer) As String
barcode = stGetBarString(n)

Visual Basic using COM

oBar = CreateObject("SoftekATL.Barcode")
.........
oBar.barstring(n)

VB.Net using the DLL

Private Declare Function stGetBarString Lib "SoftekBarcode" (ByVal nBarCode As Short) As String
barcode = stGetBarString(n)

VB.Net using the SoftekBarcode Wrapper Class

Dim barcode As SoftekBarcode
..........
barcode.GetBarString(n)

VB.Net using the SoftekBarcodeLib Managed Component

Dim barcode As SoftekBarcodeLib.BarcodeReader
..........
barcode = New SoftekBarcodeLib.BarcodeReader()
..........
barcode.GetBarString(n)

Visual C++ Using the OCX

BSTR GetBarString (short n)

Visual C++ Using the DLL

LPCSTR __stdcall stGetBarString(short index);

GetBarStringPos and GetBarStringRect 

Overview

GetBarStringPos(n, &TopLeftX, &TopLeftY, &BottomRightX, &BottomRightY)

System.Drawing.Rectangle GetBarStringRect(n)               (.Net managed component only)

In the COM object the following properties are also available:

BarStringPage(n), BarStringTopLeftX(n), BarStringTopLeftY(n), BarStringBottomRightX(n), BarStringBottomRightY(n)

GetBarStringPos returns the page number of the nth bar code found in the image - where n is indexed from 1. The page number is also indexed from 1. Call GetBarStringPos after ScanBarCode. TopLeftX, TopLeftY etc receive the coordinates of the rectangle that bounds the barcode. Note that this may only cover part of the height of the barcode.

GetBarStringRect returns the bounding rectangle that surrounds the barcode.

BarStringPage and BarStringTopLeftX etc allow access to the page number and position of a barcode through the COM object interface. This is useful when working with VB Script.

Visual Basic using the OCX

Dim n As Integer
Dim TopLeftX As Long
Dim TopLeftY As Long
Dim BottomRightX As Long
Dim BottomRightY As Long

[form.]SoftekBarcode.GetBarStringPos (n, TopLeftX, TopLeftY, BottomRightX, BottomRightY) 

Visual Basic using the DLL

Private Declare Function stGetBarStringPos Lib "SoftekBarcode" (ByVal nBarCode As Integer, ByRef TopLeftX As Long, ByRef TopLeftY As Long, ByRef BottomRightX As Long, ByRef BottomRightY As Long) As Integer

Dim n As Integer
Dim TopLeftX As Long
Dim TopLeftY As Long
Dim BottomRightX As Long
Dim BottomRightY As Long

page = stGetBarStringPos(n, TopLeftX, TopLeftY, BottomRightX, BottomRightY)

Visual Basic using COM

oBar = CreateObject("SoftekATL.Barcode")
.........
oBar.GetBarStringPos (n, TopLeftX, TopLeftY, BottomRightX, BottomRightY) 
page = oBar.BarStringPage(n)

or

page = oBar.BarStringPage(n)
TopLeftX = oBar.BarStringTopLeftX(n)
TopLeftY = oBar.BarStringTopLeftY(n)
BottomRightX = oBar.BarStringBottomRightX(n)
BottomRightY = oBar.BarStringBottomRightY(n)

 

VB.Net using the DLL

Private Declare Function stGetBarStringPos Lib "SoftekBarcode" (ByVal nBarCode As Short, ByRef TopLeftX As Long, ByRef TopLeftY As Long, ByRef BottomRightX As Long, ByRef BottomRightY As Long) As Short

Dim n As Short
Dim TopLeftX As Long
Dim TopLeftY As Long
Dim BottomRightX As Long
Dim BottomRightY As Long

page = stGetBarStringPos(n, TopLeftX, TopLeftY, BottomRightX, BottomRightY)

VB.Net using the SoftekBarcode Wrapper Class

Dim barcode As SoftekBarcode

Dim n As Short
Dim TopLeftX As Long
Dim TopLeftY As Long
Dim BottomRightX As Long
Dim BottomRightY As Long

..........
barcode.GetBarStringPos(n, TopLeftX, TopLeftY, BottomRightX, BottomRightY)

VB.Net using the SoftekBarcodeLib Managed Component

Dim barcode As SoftekBarcodeLib.BarcodeReader
Dim rect as System.Drawing.Rectangle
..........
barcode = New SoftekBarcodeLib.BarcodeReader()
..........
barcode.GetBarStringRect(n)

Visual C++ Using the OCX

short GetBarStringPos (short n, long *pTopLeftX, long *pTopLeftY, long *pBottomRightX, long *pBottomRightY);

Visual C++ Using the DLL

short __stdcall stGetBarStringPos(short nBarCode, long FAR* pTopLeftX, long FAR* pTopLeftY, long FAR* pBotRightX, long FAR* pBotRightY);

 

GetBarStringType

Overview

GetBarStringType(n)

GetBarStringType returns the type of the nth barcode (indexed from 1) found in the image. Call GetBarStringType after ScanBarCode. Possible values are "CODE39", "CODE128", "CODE25", "CODABAR", "UPCA", "UPCE", "EAN8", "EAN13" and "PATCH".

Visual Basic using the OCX

[form.]SoftekBarcode.GetBarStringType (n) 

Visual Basic using the DLL

Private Declare Function stGetBarStringType Lib "SoftekBarcode" (ByVal nBarCode As Integer) As String

strBarType = stGetBarStringPos(n)

Visual Basic using COM

oBar = CreateObject("SoftekATL.Barcode")
.........
strBarType = oBar.GetBarStringType (n) 

VB.Net using the DLL

Private Declare Function stGetBarStringType Lib "SoftekBarcode" (ByVal nBarCode As Short) As String

strBarType  = stGetBarStringType(n)

VB.Net using the SoftekBarcode Wrapper Class

Dim barcode As SoftekBarcode

..........
strBarType  = barcode.GetBarStringType(n)

VB.Net using the SoftekBarcodeLib Managed Component

Dim barcode As SoftekBarcodeLib.BarcodeReader
..........
barcode = New SoftekBarcodeLib.BarcodeReader()
..........
barcode.GetBarStringType(n)

Visual C++ Using the OCX

BSTR GetBarStringType (short n);

Visual C++ Using the DLL

LPCSTR __stdcall stGetBarStringType(short index);

 

GetBarStringDirection

Overview

GetBarStringDirection(n)

GetBarStringDirection returns the scan direction of the nth barcode (indexed from 1) found in the image and can be one of the following values:

 

 

Visual Basic using the OCX

[form.]SoftekBarcode.GetBarStringDirection (n) 

Visual Basic using the DLL

Private Declare Function stGetBarStringDirection Lib "SoftekBarcode" (ByVal nBarCode As Integer) As Integer

iBarDirection = stGetBarStringPos(n)

Visual Basic using COM

oBar = CreateObject("SoftekATL.Barcode")
.........
iBarDirection = oBar.GetBarStringDirection (n) 

VB.Net using the DLL

Private Declare Function stGetBarStringDirection Lib "SoftekBarcode" (ByVal nBarCode As Short) As Integer

iBarDirection = stGetBarStringDirection(n)

VB.Net using the SoftekBarcode Wrapper Class

Dim barcode As SoftekBarcode

..........
iBarDirection = barcode.GetBarStringDirection(n)

VB.Net using the SoftekBarcodeLib Managed Component

Dim barcode As SoftekBarcodeLib.BarcodeReader
..........
barcode = New SoftekBarcodeLib.BarcodeReader()
..........
barcode.GetBarStringDirection(n)

Visual C++ Using the OCX

short GetBarStringDirection (short n);

Visual C++ Using the DLL

short __stdcall stGetBarStringDirection(short index);

 

ScanBarCode

Overview

ScanBarCode(file)

Scan the specified TIF, BMP or JPEG file for bar code strings and return the number of bar codes found in the file. The following formats are supported:

If the returned value is less than 0 then an error has occurred:

Value Comment
-1 Error opening file
-2 File is Multi Plane
-3 Invalid number of bits per sample
-4 Memory allocation error
-5 Invalid TIF photometric value
-6, -7 or -8 The trial period on a demo version has either expired or this trial version is no longer valid for installation.

n is the index to the barcode string to be retrieved and is indexed from 1.

The following strings can be returned for patch codes - "Type I", "Type II", "Type III", "Type IV", "Type VI" and "Type T".

Visual Basic using the OCX

count = [form.]SoftekBarcode.ScanBarCode(file)

Visual Basic using the DLL

Private Declare Function stScanBarCode Lib "SoftekBarcode" (ByVal strFile As String) As Integer
count = stScanBarCode(file)

Visual Basic using COM

oBar = CreateObject("SoftekATL.Barcode")
.........
oBar.ScanBarCode(file)
count = oBar.BarCodeCount

VB.Net using the DLL

Private Declare Function stScanBarCode Lib "SoftekBarcode" (ByVal strFile As String) As Short
count = stScanBarCode(file)

VB.Net using the SoftekBarcode Wrapper Class

Dim barcode As SoftekBarcode
..........
count = barcode.ScanBarCode(file)

VB.Net using the SoftekBarcodeLib Managed Component

Dim barcode As SoftekBarcodeLib.BarcodeReader
..........
barcode = New SoftekBarcodeLib.BarcodeReader()
..........
barcode.ScanBarCode(file)

Visual C++ Using the OCX

short ScanBarCode(file)

Visual C++ Using the DLL

short __stdcall stScanBarCode(LPCTSTR file);

 

ScanBarCodeFromBitmap

Overview

ScanBarCodeFromBitmap(hBitmap)

Scan the specified device dependent bitmap for bar code strings and return the number of bar codes found. The image must be single plane. Note that hBitmap is a HANDLE to a BITMAP, not the address of a BITMAP structure.

The managed component supports 2 forms of this function:

ScanBarCodeFromBitmap(IntPtr hBitmap)

ScanBarCodeFromBitmap(System.Drawing.Bitmap bitmap) (Managed Component Only) 

Scan the specified managed bitmap object for bar code strings and return the number of bar codes found.

If the returned value is less than 0 then an error has occurred:

Value Comment
-1 N/A
-2 Bitmap file is Multi Plane
-3 N/A
-4 N/A
-5 N/A
-6, -7 or -8 The trial period on a demo version has either expired or this trial version is no longer valid for installation.

 

Visual Basic using the OCX

count = [form.]SoftekBarcode.ScanBarCodeFromBitmap(hBitmap)

Visual Basic using the DLL

Private Declare Function stScanBarCodeFromBitmap Lib "SoftekBarcode" (ByVal hBitmap As Long) As Integer
count = stScanBarCodeFromBitmap(hBitmap)

Visual Basic using COM

Not yet supported in this interface.

VB.Net using the DLL

Private Declare Function stScanBarCodeFromBitmap Lib "SoftekBarcode" (ByVal hBitmap As IntPtr) As Short
count = stScanBarCodeFromBitmap(hBitmap)

VB.Net using the SoftekBarcode Wrapper Class

Dim barcode As SoftekBarcode
..........
count = barcode.ScanBarCodeFromBitmap(hBitmap)

VB.Net using the SoftekBarcodeLib Managed Component

Dim barcode As SoftekBarcodeLib.BarcodeReader
....
nBarCode = barcode.ScanBarCodeFromBitmap(Me.PictureBox1.Image)

or

nBarCode = barcode.ScanBarCodeFromBitmap(hBitmap)

Visual C++ Using the OCX

short ScanBarCodeFromBitmap(long hBitmap)

Visual C++ Using the DLL

short __stdcall stScanBarCodeFromBitmap(long hBitmap);

 

ScanBarCodeFromDIB

Overview

ScanBarCodeFromDIB(hDIB)

Scan the specified device independent bitmap for bar code strings and return the number of bar codes found. The image must be single plane.

If the returned value is less than 0 then an error has occurred:

Value Comment
-1 N/A
-2 DIB file is Multi Plane
-3 N/A
-4 N/A
-5 N/A
-6, -7 or -8 The trial period on a demo version has either expired or this trial version is no longer valid for installation.

Visual Basic using the OCX

count = [form.]SoftekBarcode.ScanBarCodeFromDIB(hDIB)

Visual Basic using the DLL

Private Declare Function stScanBarCodeFromDIB Lib "SoftekBarcode" (ByVal hDIB As Long) As Integer
count = stScanBarCodeFromDIB(hDIB)

Visual Basic using COM

Not yet supported in this interface.

VB.Net using the DLL

Private Declare Function stScanBarCodeFromDIB Lib "SoftekBarcode" (ByVal hDIB As IntPtr) As Short
count = stScanBarCodeFromDIB(hDIB)

VB.Net using the SoftekBarcode Wrapper Class

Dim barcode As SoftekBarcode
..........
count = barcode.ScanBarCodeFromDIB(hDIB)

VB.Net using the SoftekBarcodeLib Managed Component

Dim barcode As SoftekBarcodeLib.BarcodeReader
....
nBarCode = barcode.ScanBarCodeFromDIB(hDIB)

Visual C++ Using the OCX

short ScanBarCodeFromDIB(long hDIB)

Visual C++ Using the DLL

short __stdcall stScanBarCodeFromDIB(long hDIB);

 

SetScanRect

Overview

SetScanRect(TopLeftX, TopLeftY, BottomRightX, BottomRightY, nMappingMode)

SetScanRect specifies the bounding rectangle in the image that should be searched for barcodes. To clear the rectangle and search the entire image set the rectangle to (-1, -1, -1, -1). The top left hand corner of an image is (0,0).

nMappingMode can have the following values:

Visual Basic using the OCX

[form.]SoftekBarcode.SetScanRect(TopLeftX, TopLeftY, BottomRightX, BottomRightY, nMappingMode)

Visual Basic using the DLL

Private Declare Function stSetScanRect Lib "SoftekBarcode" (ByVal TopLeftX As Long, ByVal TopLeftY As Long, ByVal BottomRightX As Long, ByVal BottomRightY As Long, ByVal nMappingMode As Integer) As Bool

stSetScanRect(TopLeftX, TopLeftY, BottomRightX, BottomRightY, nMappingMode)

Visual Basic using COM

oBar = CreateObject("SoftekATL.Barcode")
.........
oBar.SetScanRect (TopLeftX, TopLeftY, BottomRightX, BottomRightY, nMappingMode) 

VB.Net using the DLL

Private Declare Function stSetScanRect Lib "SoftekBarcode" (ByVal TopLeftX As Long, ByVal TopLeftY As Long, ByVal BottomRightX As Long, ByVal BottomRightY As Long, ByVal nMappingMode As Integer) As Bool

stSetScanRect(TopLeftX, TopLeftY, BottomRightX, BottomRightY, nMappingMode)

strBarType  = stGetBarStringType(n)

VB.Net using the SoftekBarcode Wrapper Class

Dim barcode As SoftekBarcode

..........
barcode.SetScanRect (TopLeftX, TopLeftY, BottomRightX, BottomRightY, nMappingMode) 

VB.Net using the SoftekBarcodeLib Managed Component

Not implemented yet.

Visual C++ Using the OCX

short SetScanRect(long TopLeftX, long TopLeftY, long BottomRightX, long BottomRightY, long nMappingMode);

Visual C++ Using the DLL

BOOL __stdcall stSetScanRect(long TopLeftX, long TopLeftY, long BottomRightX, long BottomRightY, short nMappingMode);

Barcode Recognition Software