BarcodeList Methods



item
Allows random access to individual nodes within the collection.

Syntax
object.item(index)
Parameters
index Index of the item within the collection. The first item is number zero.
Return Value
Object. Returns IBarcode. Returns Null if the index is out of range.
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



nextNode
Returns the next node in the collection.

Syntax
object.nextNode()
Return Value
Object. Returns IBarcode. Returns Null if there is no next node.
Remarks
The first call to nextNode returns the first node in the list. This method returns Null when the current node is the last node or there are no items in the list. The iterator can be reset by calling the reset method.
Example
[Script]

var dec = new ActiveXObject("BarcodeReader.BarcodeDecoder");
var objBarcodeList;
var objBarcode;

dec.LinearFindBarcodes = 7;

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

objBarcodeList = dec.Barcodes;
for (var i=0; i < objBarcodeList.length; i++)
{
  objBarcode = objBarcodeList.nextNode();
  alert(objBarcode.Text);
}

[Visual Basic]

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

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

Dim bl As BarcodeList
Set bl = dec.Barcodes
For i = 0 To bl.length - 1
  MsgBox bl.nextNode.Text
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) );
   _ASSERTE( SUCCEEDED(hr) );

   pIBarcodeDecoder->put_LinearFindBarcodes( 7 );

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

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

   IBarcodePtr pBarcode;
   while( pBarcode = pIBarcodeList->nextNode() )
   {
      printf( "%s\n", (LPCTSTR)pBarcode->Text );
   }

   return 0;
}



reset
Resets the iterator.

Syntax
object.reset()
Return Value
No return value.
Remarks
This method reinitializes the iterator to point before the first node in the IBarcodeList so that the next call to nextNode returns the first item in the list.