Code snippets for Visual C++
This article shows 2 simple visual c++ code snippets that use either the standard windows dll or the com object for the toolkit.
Standard Windows DLL
hBarcode = mtCreateBarcodeInstance() ;
//Set properties
mtSetReadCode128 (hBarcode, 1) ;
//Read barcodes
int nBarCodes = mtScanBarCode(hBarcode, m_ImageFile) ;
//Get results
for (int i = 1; i <= nBarCodes; i++)
CString strBarCode = mtGetBarString(hBarcode, i) ;
mtDestroyBarcodeInstance(hBarcode) ;
ActiveX/OCX Interface
//Set properties
m_barcode.SetReadCode128 (1) ;
//Read barcodes
int nBarCodes = m_barcode.ScanBarCode(m_ImageFile) ;
//Get results
for (int i = 1; i <= nBarCodes; i++)
CString strBarCode = m_barcode.GetBarString(i) ;