BarcodeDecoder Overview

Description
Main barcode recognition object
Example
[Script]

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

[Visual Basic]

'Create a new instance of Barcode Decoder object
Dim dec As Object
Set dec = CreateObject("BarcodeReader.BarcodeDecoder")
dec.BarcodeTypes = &H1 Or &H8 Or &H80 'only Code128, EAN13 and UPCA
dec.ShowImage = False
dec.LinearFindBarcodes = 7

'decode file
dec.DecodeFile ("c:\barcodes.jpg")

'show results
For i = 0 To dec.Barcodes.length - 1
   Dim bc As Barcode
   Set bc = dec.Barcodes.Item(i)
   txt = ""
   If bc.BarcodeType = Codabar Then txt = txt & "Codabar"
   If bc.BarcodeType = Code11 Then txt = txt & "Code11"
   If bc.BarcodeType = Code128 Then txt = txt & "Code128"
   If bc.BarcodeType = Code39 Then txt = txt & "Code39"
   If bc.BarcodeType = EAN13 Then txt = txt & "EAN13"
   If bc.BarcodeType = EAN8 Then txt = txt & "EAN8"
   If bc.BarcodeType = Interl25 Then txt = txt & "Interl25"
   If bc.BarcodeType = UPCA Then txt = txt & "UPCA"
   If bc.BarcodeType = UPCE Then txt = txt & "UPCE"
   txt = txt & ": " & bc.Text
   txt = txt & " (" & bc.X1 & "," & bc.Y1 & ")," & "(" & bc.X2 & "," & _
       bc.Y2 & ")," & "(" & bc.x3 & "," & bc.y3 & ")," & "(" & bc.x4 & _
       "," & bc.y4 & ")"
   MsgBox txt
Next i

Set dec = Nothing

[C/C++]

#include <crtdbg.h>
#include <atlcomcli.h>

#import "progid:BarcodeReader.BarcodeDecoder" no_namespace

int _tmain(int argc, _TCHAR* argv[])
{
   HRESULT hr = ::CoInitialize( NULL );
   _ASSERTE( SUCCEEDED(hr) );

   CComPtr<IBarcodeDecoder> pIBarcodeDecoder;
   hr = pIBarcodeDecoder.CoCreateInstance( __uuidof(BarcodeDecoder) );
   _ASSERT( SUCCEEDED(hr) );

   pIBarcodeDecoder->put_LinearFindBarcodes( 7 );

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

   CComPtr<IBarcodeList> pIBarcodeList;
   hr = pIBarcodeDecoder->get_Barcodes( &pIBarcodeList );
   _ASSERTE( pIBarcodeList );

   long len;
   hr = pIBarcodeList->get_length( &len );
   _ASSERTE( pIBarcodeList );

   for( long i=0; i < len; ++i )
   {
      CComPtr<IBarcode> pBarcode;
      pBarcode = pIBarcodeList->item( i );
      _ASSERTE( pBarcode );

      printf( "%s\n", (LPCTSTR)pBarcode->Text );
   }

   return 0;
}


Members
Properties
BarcodeTypes r/w Returns or sets what types of barcodes should be decoded.
LinearFindBarcodes r/w Determines how many barcodes should be decoded on the image.
LinearShowSymbologyID r/w Returns or sets the value determining whether to add Symbology ID to the barcode text or not.
LinearVerifyCheckDigit r/w Verify or not the optional check digit in barcodes.
LinearShowCheckDigit r/w Show the check digit.
LinearShowStartStop r/w Show the start/stop characters.
LinearCode39EnableExtended r/w decode Code 39 as Code 39 Extended.
LinearUPCE2UPCA r/w Convert a UPC-E barcode to UPC-A.
ShowImage r/w Returns or sets the value determining whether to show the image and the decoded barcodes or not.
FileName r/w Returns or sets the name of the file you need to decode.
InverseType r/w Returns or sets what barcodes should be decoded (darks on light or lights on dark).
BarcodeCount r Returns the number of decoded barcodes.
Barcodes r Returns the BarcodeList object that contains the collection of decoded barcodes.

Methods
DecodeFile Decodes barcodes in the specified image file.
DecodeFileRect Decodes a certain part of the image.
DecodeStream Decodes barcodes from image stream.
DecodeStreamRect Decodes a certain part of the image.
DecodeGrayMap Decodes barcodes from gray map stream.
DecodeGrayMapRect Decodes a certain part of the image.
SetProperty Sets additional Barcode Decoder object properties.
GetProperty Returns the properties set with the SetProperty method.
GetSDKInfo Returns various SDK information.