Using the Multi-Threaded set of dll functions
The SoftekBarcode.dll includes a set of functions suitable for use in multi-threaded applications. The multi-threaded functions all require a handle to the toolkit. This is created using the mtCreateBarcodeSession function and released using the mtDestroyBarcodeSession function:
hBarcode = mtCreateBarcodeInstance() nBarcodes = mtScanBarCode(hBarcode, “input.tif”) …process the result in some way mtDestroyBarcodeInstance(hBarcode)
All the multi-threaded functions begin with “mt” and exactly mirror the “st” set of functions. For example, the function stSetReadCode39(bool value) can be used to control whether the sdk reads Code 39 barcodes, and the multi-threaded version is mtSetReadCode39(handle hBarcode, bool value). Similarly, the function stScanBarCode(string filePath) is used to scan an image file for a barcode, and the multi-threaded version is mtScanBarCode(handle hBarcode, bool value).
CreateBarcodeInstance
Syntax
mtCreateBarcodeInstance()
Return Value
Handle to an instance of the barcode toolkit (dll only).
Remarks
CreateBarcodeInstance creates an instance of the barcode toolkit and returns a handle that may be used with other functions in the win32 dll interface. Please note that this function is not applicable to other interfaces for the toolkit. This function only exists in the dll interface to the SDK.
Example:
Dim hBarcode As System.IntPtr
hBarcode = mtCreateBarcodeInstance()
mtSetReadCode39(hBarcode, True)
Win32 dll declarations:
VB.Net:
Private Declare Function mtCreateBarcodeInstance Lib “Softekbarcode” () As System.IntPtr
Visual C++:
extern “C” {
HANDLE __stdcall mtCreateBarcodeInstance() ;
}
DestroyBarcodeInstance
Syntax
mtDestroyBarcodeInstance(hBarcode)
Parameters
hBarcode Handle to an instance of the barcode toolkit.
Return Value
1/True on success and 0/False on failure.
Remarks
DestroyBarcodeInstance destroys an instance of the barcode toolkit and releases any resources used by the toolkit. This function only exists in the dll interface to the SDK.
Example:
Dim hBarcode As System.IntPtr
hBarcode = mtCreateBarcodeInstance()
mtDestroyBarcodeInstance(hBarcode)
Win32 dll declarations:
VB.Net:
Private Declare Function mtDestroyBarcodeInstance Lib “Softekbarcode” (ByVal hBarcode As System.IntPtr) As Short
Visual C++:
extern “C” {
short __stdcall mtDestroyBarcodeInstance(HANDLE hBarcode) ;
}