BarcodeTools.com
Professional BarCode Software
Home
Barcode ActiveX
DataMatrix ActiveX
PDF417 ActiveX
Barcode .NET
DataMatrix .NET
PDF417 .NET
Barcode ASP.NET
DataMatrix ASP.NET
PDF417 ASP.NET
ISAPI
CGI
LabelBar(Pro)
Console Apps
Barcode Recognition
Order
FAQs
Flash Tutorials
Support
Barcode Types
Search
Home arrow Barcode Recognition arrow More Info arrow Methods
BarcodeDecoder Methods Print E-mail
AboutBox Method
Opens an About window.

Syntax
object.AboutBox()
Return Value
No return value.



DecodeFile Method
Decodes barcodes in the specified image file.

Syntax
object.DecodeFile(FileName)
Parameters
FileNameA string defining the file name.
Return Value
Integer. Returns the number of decoded barcodes.
Example
[Script]

var dec = new ActiveXObject("BarcodeReader.BarcodeDecoder");
var objBarcode;
dec.DecodeFile("c:\\barcodes.jpg");
for (var i=0; i < dec.Barcodes.length; i++)
{
  objBarcode = dec.Barcodes.item(i);
  alert(objBarcode.Text);
}

[Visual Basic]

Dim dec As Object
Set dec = CreateObject("BarcodeReader.BarcodeDecoder")

dec.DecodeFile ("c:\barcodes.jpg")

For i = 0 To dec.Barcodes.length - 1
   Dim bc As Barcode
   Set bc = dec.Barcodes.Item(i)
   MsgBox bc.Text
Next i

Set dec = Nothing

[C/C++]

//creates the barcode decoder object
CComPtr<IBarcodeDecoder> pIBarcodeDecoder;
HRESULT hr = pIBarcodeDecoder.CoCreateInstance( 
  _T("BarcodeReader.BarcodeDecoder") );
_ASSERTE( SUCCEEDED(hr) );

hr = pIBarcodeDecoder->DecodeFile( _bstr_t("c:\\barcodes.jpg") );
_ASSERTE( SUCCEEDED(hr) );



DecodeFileRect Method
Similar to the DecodeFile method, but searches only a certain part of the image defined by the parameters x, y, width, height.

Syntax
object.DecodeFileRect(FileName, x, y, width, height)
Parameters
FileNameA string defining the file name.
xAn integer value that defines the X coordinate of scanning zone.
yAn integer value that defines the Y coordinate of scanning zone.
widthAn integer that defines the width of scanning zone.
heightAn integer that defines the height scanning zone.
Return Value
Integer. Returns the number of decoded barcodes.



DecodeStream Method
Similar to the DecodeFile method, but a file in the form of a data stream is passed as a parameter. Everything that is contained in the image file is passed as a data stream.

Syntax
object.DecodeStream(FileStream)
Parameters
FileStreamA Variant that contains a safe array of Bytes.
Return Value
Integer. Returns the number of decoded barcodes.
Remarks
This method is convenient when there is no need to save the barcode image to a file, for instance, while decoding barcodes from some video capture device.



DecodeStreamRect Method
Similar to the DecodeStream method, but searches only a certain part of the image defined by the parameters x, y, width, height.

Syntax
object.DecodeStreamRect(FileStream, x, y, width, height)
Parameters
FileStreamA Variant that contains a safe array of Bytes.
xAn integer value that defines the X coordinate of scanning zone.
yAn integer value that defines the Y coordinate of scanning zone.
widthAn integer that defines the width of scanning zone.
heightAn integer that defines the height scanning zone.
Return Value
Integer. Returns the number of decoded barcodes.



DecodeGrayMap Method
This method finds barcodes in a raw gray map. It is the fastest method as compared to the other methods because no additional image transformations are performed in this case.

Syntax
object.DecodeGrayMap(GrayMap, GrayMapWidth, GrayMapHeight)
Parameters
GrayMapA Variant that contains a safe array of Bytes.
GrayMapWidthGray map width.
GrayMapHeightGray map height.
Return Value
Integer. Returns the number of decoded barcodes.
Remarks
A gray map is a byte matrix. Each byte has the value from 0 to 255 and represents one image pixel.
0 means a black pixel, 255 means a white pixel.
The matrix is passed to the DecodeGrayMap method as a one-dimensional array. The first upper line of the image is sent first, then comes the second line and so on.
See the picture below for explanation.

Decode barcodes from raw gray map stream
Example
[C/C++]

const BYTE pgm[6300] = {
  0xff,0xff,0xff,0xff,0xff,0xff,0x0,0x0,0x0,0x0, //...
};

//creates the barcode decoder object
CComPtr<IBarcodeDecoder> pIBarcodeDecoder;
HRESULT hr = pIBarcodeDecoder.CoCreateInstance( 
  _T("BarcodeReader.BarcodeDecoder") );
_ASSERTE( SUCCEEDED(hr) );

//creates the safe array
CComVariant var;
var.vt = VT_ARRAY | VT_UI1;
var.parray = SafeArrayCreateVector( VT_UI1, 0, sizeof(pgm) );
_ASSERTE( var.parray );

//locks the safe array
BYTE* pSaBuf=NULL;
if( SUCCEEDED(SafeArrayAccessData(var.parray, (void HUGEP**)&pSaBuf)) )
{
   //copy the image into the safe array
   memcpy( pSaBuf, pgm, sizeof(pgm) );
   //unlock safe array
   SafeArrayUnaccessData( var.parray );
}

hr = pIBarcodeDecoder->DecodeGrayMap( var, 105, 60 );



DecodeGrayMapRect Method
Similar to the DecodeGrayMap method, but searches only a certain part of the image defined by the parameters x, y, width, height.

Syntax
object.DecodeGrayMapRect(GrayMap, GrayMapWidth, GrayMapHeight,
  x, y, width, height)
Parameters
GrayMapA Variant that contains a safe array of Bytes.
GrayMapWidthGray map width.
GrayMapHeightGray map height.
xAn integer value that defines the X coordinate of scanning zone.
yAn integer value that defines the Y coordinate of scanning zone.
widthAn integer that defines the width of scanning zone.
heightAn integer that defines the height scanning zone.
Return Value
Integer. Returns the number of decoded barcodes.



 

  Home   Order   FAQs   Support   Search

Copyright © 1999-2008, RKD Software, All rights reserved.
All trademarks mentioned are the property of their respective owners.