Document/Medical Features
Raster Pro/Document/Medical Features

Raster Pro:

LEADTOOLS Raster Imaging Pro provides some imaging capabilities that are not available in the LEADTOOLS Raster Imaging product.  In order to access these features, you must unlock support for L_SUPPORT_LTPRO, using L_UnlockSupport.  To unlock these features, call L_UnlockSupport(L_SUPPORT_LTPRO, L_KEY_LTPRO). L_KEY_LTPRO can be found in ltkey.h.

If you are a licensed user of LEADTOOLS Raster Imaging, and would like to access Raster Imaging Pro features, you must contact Tech Support for information on obtaining a license and the unlock key for calling L_UnlockSupport.

Document/Medical:

LEADTOOLS Document Imaging, LEADTOOLS Document Imaging Suite, LEADTOOLS Medical Imaging and LEADTOOLS Medical Imaging Suite are the most comprehensive imaging toolkits on the market.  No other toolkit provides as many imaging features for color, gray-scale and black & white images in one development package, and for one price.  These toolkits comprise LEAD's best code and are designed for the programmer who is looking for the fastest performance, and/or the most extensive color, document, and medical imaging capabilities available.

These toolkits contain powerful annotation capabilities and optimized document image processing filters, and high performance compression, decompression and viewing of JPEG, LEAD CMP, and CCITT G3/G4. The annotation capabilities enable the programmer to add text, highlights, sticky notes, audio, ellipses, buttons, lines, arrows, rectangles, polygons, redaction (blackout), hotspots, freehand scribble, pointers, bitmap and text stamps, to black & white and color images.  Programmers working with document imaging will also find special processing filters such as despeckle, deskew, favor black, and scale to gray to enhance their black and white 1 bit images.  Additionally, you can achieve faster rotation in 90-degree increments by applying a rotated view perspective to the bitmap. These LEADTOOLS toolkits offer the fastest software-only JPEG decoder available.

LEADTOOLS Document Imaging

The LEADTOOLS Document Imaging toolkit contains all the features available in the LEADTOOLS Raster Imaging Pro. In addition, it contains the following capabilities:

 Special functions for Document (bitonal) images. The LEADTOOLS functions for bitonal images are especially useful for working with images from black-and-white scanners or FAX machines. These functions let you do things such as automatically straighten (deskew) an image, remove spots (despeckle), or clarify a scaled display (using scale-to-gray and favor-black features).

 Annotation. LEADTOOLS supports annotation of images by letting you overlay images with text, lines, shapes, arrows, buttons, highlights, hot spots, sticky notes, stamps, buttons, and sounds.

 Fast rotation. LEADTOOLS achieves fast rotation in 90-degree increments by applying a rotated view perspective to the bitmap.

 ISIS support. LEADTOOLS supports ISIS interfaces for driving scanning devices.

 Faster compression and decompression. The Document/Medical editions work faster when loading and saving LEAD CMP, JPEG, and CCITT Group 3 and Group 4 images. The LEADTOOLS functions for loading and saving are the same in all products. The only difference is in performance.

 1-bit Image Clean-up. The Document toolkits include support for removing dots, blobs, holes, inverted text, lines, borders, bumps and nicks from 1-bit images.

 Region Clean-up. [Document/Medical] Remove all the holes from a region.

 Embedded Messages. The Document toolkits include support for embedding messages in lossless image formats like bmp, tiff, lossless jpeg, etc. The message is embedded without any visible changes to the image, and does not appreciably increase the size of the image. The message is password-protected.

 12 and 16 bit grayscale images. [Document/Medical] Load, process, display, window level and save 12 and 16 bit grayscale images (including support for 16-bit grayscale TIFF).

 48 and 64 bit color images. [Document/Medical] Load, process, display, and save 48 and 64 bit color images.

 MRC Support. [Document/Medical] LEADTOOLS supports the Mixed Raster Content format for color documents containing mixed image and text components. For more information, refer to the Main COM Help file (Ltcomn.chm) in the Help directory.

 Halftoning. [Document/Medical] Convert 1-, 4-, 8-, 16-, 24-, or 32-bit bitmaps to a halftoned bitmap, with a specified pattern rotation. A halftoned bitmap is a 1-bit bitmap that has been dithered for black and white printing or display.

LEADTOOLS Document Imaging Suite

The LEADTOOLS Document Imaging Suite toolkit contains all the capabilities of LEADTOOLS Document Imaging, and includes the features listed below. Please note that the OCR features are included in this toolkit, however they can also be purchased as a plug-in for the LEADTOOLS Document Imaging toolkit. Also, JBIG support is provided in this toolkit, however a JBIG Module may be added on to LEADTOOLS Document Imaging, LEADTOOLS Medical Imaging or LEADTOOLS Medical Imaging Suite.

 OCR features. [Document/Medical] LEAD offers OCR features that use Scansoft Textbridge technology. Support for these features is included in the LEADTOOLS Document Imaging Suite, and can be added, via plug-in to the LEADTOOLS Document Imaging, LEADTOOLS Medical Imaging and LEADTOOLS Medical Imaging Suite toolkits. The OCR features allow you to perform optical character recognition and turn images into documents. Features include preset confidence and accuracy levels for controlling how sensitive the engine is to unrecognized text, artificial intelligence for improving recognition on documents of the same type, and built-in and user-defined lexicons for limiting the type of text to recognize within a particular zone. LEADTOOLS provides the ability to verify or correct text during, and (using LEAD's unique OCR editor) after recognition. LEAD's OCR editor ties the text being edited directly to the image, providing a visual reference to the original bitmap data. The OCR engine can perform Automatic area segmentation creating multi-layered zones, recognizing areas such as tables, rules, images and text. Or, you can manually designate up to 250 such zones. The OCR features support different fonts, sizes (5 to 72 point) and styles. Fax, dot matrix and halftones can be preprocessed to improve recognition results. The OCR Engine supports major European and Scandinavian languages (Danish, Dutch, Finnish, French, German, Italian, Norwegian, Portuguese, Russian, Spanish, and Swedish) as well as English. Support for dialects such as US. English, French Canadian, Latin American Spanish, Swiss German, and Brazilian Portuguese is also provided.

Recognized text can be exported to more than 40 different formats, including MS Word, MS Excel, Dbase andWordPerfect. The LEADTOOLS OCR features contain superior OCR processing speeds, for use in form recognition and processing applications.

 LEAD's JBIG filter. [Document/Medical] LEAD includes support for this filter in the LEADTOOLS Document Imaging Suite toolkit. Support for this filter can be added to LEADTOOLS Document Imaging, LEADTOOLS Medical Imaging or LEADTOOLS Medical Imaging Suite by purchasing the JBIG Module. JBIG defines a method for lossless compression encoding of a bi-level image (two-color image). This method can also be used for coding grayscale and color images. LEADTOOLS completely supports all three types of images, giving you the ability to make full use of this powerful compression technology.  LEADTOOLS also supports the progressive capability of JBIG, allowing you to store and send multiple representations of images at different resolutions without any extra storage overhead.

LEADTOOLS Medical Imaging

LEADTOOLS Medical Imaging contains all the capabilities of LEADTOOLS Document Imaging.  It also includes general medical imaging technologies (1-16,24,32 bit color, 1-16 bit grayscale and window leveling of 12 and 16-bit grayscale images) and support for the DICOM file format.

 DICOM file support. [Medical] LEADTOOLS Medical Imaging provides COMPLETE support for the DICOM 3.0 specification, including all standard IOD classes and modalities (CR, CT, MR, NM, US, RF, SC, VL, etc.) and complete DICOM Basic Directory support.

 Window leveling. [Medical] Detect and set LowBit and HighBit for image data, display images with automatic LUT intensity expansion, or set LUT entries and ranges with specific values and gradients. Display images through the LUT without changing the data, or process the image data using the LUT. Linearize the number of pixels locally in a bitmap, based on the specified color space in order to bring out the detail in dark areas of an image, and smooth the edges between blocks.

 Medical Imaging Processing. [Medical] LEADTOOLS Medical Imaging provides image processing functionality designed specifically to allow you to examine and improve the quality of medical images.

LEADTOOLS Medical Imaging Suite

LEADTOOLS Medical Imaging Suite contains all the capabilities of LEADTOOLS Medical Imaging. In addition, it supports the following:

 DICOM Communication support. [Medical Suite] LEADTOOLS provides COMPLETE support for DICOM Communications, including all Service Classes (Verification, Storage, Query/Retrieve, Patient Management, etc), and contains high-level communications functions simplifying the creation of DICOM client/server applications.

(Document/Medical) is used in the documentation to designate the features that are available in LEADTOOLS Document Imaging, LEADTOOLS Document Imaging Suite, LEADTOOLS Medical Imaging and LEADTOOLS Medical Imaging Suite. Those features that are available only in the Medical toolkits are indicated in the documentation by (Medical). Features available only in the LEADTOOLS Medical Imaging Suite toolkit are indicated in the documentation by (Medical Suite).

(Internet only) is used in the documentation to designate the features that are available only in the LEADTOOLS Internet toolkit.

For more information, refer to Document/Medical Edition Support and Licensing Requirements.

	Click this button to start a new WinHelp session to review the full line of LEADTOOLS Products.


LEADTOOLS Documentation
LEADTOOLS Reference Manuals

LEADTOOLS provides reference manuals that contain the same information as the online help. You can print them from PDF files. Please note that due to the large size of the PDF files that contain the LEADTOOLS manuals, these files are no longer included in the setup. Instead, these PDF files can be downloaded from our website at http://support.leadtools.com/SupportPortal/DesktopDefault.aspx?tabindex=3&tabid=27.

To print the PDF files, you must use the Adobe Acrobat Reader 3.0 or higher.  You can download a copy of the Acrobat Reader from the Adobe web site (http://www.adobe.com). Note that different versions of the Acrobat Reader are available for different operating systems, but they all can read the same PDF files.


Installation Directory

The installation procedure creates a directory tree for the LEADTOOLS files, demonstration programs and online help. You specify the root directory during installation.

Please note that due to the large size of the PDF files that contain the LEADTOOLS manuals, these files are no longer included in the setup. Instead, these PDF files can be downloaded from our website at http://support.leadtools.com/SupportPortal/DesktopDefault.aspx?tabindex=3&tabid=27.

The following is a list of the subdirectories in the root directory:

BIN	Executable files for the demonstration programs.
HELP	Online help files.
IMAGES	Sample images and databases containing images.
EXAMPLES\DLL	One subdirectory for each example API program.
EXAMPLES\OCX	One subdirectory for each example ActiveX program.
EXAMPLES\CLASSLIB	One subdirectory for each example Class Library program.
EXAMPLES\RES	Resource files for the example programs.
INCLUDE	Header files, BAS files, and the ActiveX's MFC interface files for versions of Visual C++ earlier than 4.0.
INCLUDE\CLASSLIB	Header files for the Class Library
LIB	Library files.
REDIST	Redistributable files. These are copies of the LEADTOOLS files and other files that you may need to distribute with your application. For exact information about required files, refer to Files To Be Included With Your Application.
REDIST\NONAGLTKRN	This directory contains the LTKRN DLL that must be distributed with your application.


Syntax

This is the internal syntax of the property, method, or event. The external syntax depends on the development system you are using. Refer to the code example for your system, or for general information, refer to the following:

Visual Basic Syntax

Visual C++ 4.0 Syntax


Visual Basic Syntax

The syntax for the LEAD control's properties, methods, and events is the same as for other controls in Visual Basic.

Whenever you declare a variable as a data type, you need to know how the ActiveX data type is expressed in Visual Basic. Refer to the following table for the appropriate data type:

ActiveX Data Type	Visual Basic Data Type
boolean	Boolean
BSTR	String
IPictureDisp	Picture
long	Long
OLE_HANDLE	Integer on a 16-bit system; Long on a 32-bit system
OLE_COLOR	Long color value (such as the RGB return value)
OLE_XPOS_PIXELS	Long
OLE_YPOS_PIXELS	Long
short	Integer
float	Single


Visual C++ 4.0 Syntax

In Version 4.0 of Visual C++, the MicroSoft Foundation Class (MFC) library provides an ActiveX interface. This topic describes how to use the interface with the LEADTOOLS ActiveX.

Alternatively, to create an instance of the LEAD control at run time, use the Create function, which has the following prototype:

BOOL Create( LPCTSTR lpszWindowName, DWORD dwStyle,
const RECT&rect, CWnd* pParentWnd, UINT nID,
CFile* pPersist = NULL, BOOL bStorage = FALSE,
BSTR bstrLicKey = NULL);

Provide parameters as follows:

lpszWindowName	Use "", because the control window does not need a name.
dwStyle	Use 0 for the default style.
&rect	Use the CRect function. For example: CRect(0,0,50,50).
pParentWnd	Use this to refer to the current window.
nID	Use 0 for the default ID.
pPersist	Use NULL.
bStorage	Use FALSE.
bstrLicKey	Use the LEADTOOLS license string, which is always the first line in the LTOCX14.LIC file. For example: "LEADTOOLS OCX Copyright (c) 2005 LEAD Technologies, Inc." If you do not specify this string correctly, the ActiveX will not work when you distribute your application.
For example, the following code comes from the EXAMPLES\OCX\MFC40\DEMO\MAINDEMO.CPP file:

static const WCHAR BASED_CODE _szLicString[] =
   L"LEADTOOLS OCX Copyright (c) 2005 LEAD Technologies, Inc.";
     o
     o
     o
m_pLead = new CLead;
// pass the license string to the CLead::Create function.
// The CLead::Create expects a BSTR parameter and SysAllocString converts the
// WCHAR[] to a BSTR
BSTR lpLic = SysAllocString(_szLicString);
m_pLead->Create("", 0,CRect(0,0,50,50),this,0,NULL,FALSE,lpLic);
m_pLead->ShowWindow(SW_HIDE);
SysFreeString(lpLic);

When getting or setting a property value, you must use a function that is created by adding a prefix to the property name.

To set a property value, the syntax is as follows:

m_controlname.Setpropertyname(value);

For example:

m_Lead1.SetRubberBandVisible(FALSE);

To get a property value, the syntax is as follows:

value = m_controlname.Getpropertyname();

For example:

HeightFactor = m_Lead1.GetBitmapHeight();

To set a property array value, the syntax is as follows:

m_controlname.Setpropertyname(index, value);

For example:

m_Lead1.SetRemapTable(MyIndex, (255 * Offset) / CurrentRange);

To get a property array value, the syntax is as follows:

value = m_controlname.Getpropertyname(index);

For example:

m_Lead1.SetBitmap(m_Lead1.GetColorPlanes(3)); // Copy the K plane


Visual Basic Constants for Key Codes

Do the following to find the Visual Basic key codes:

1.	On the View pull-down menu, select Object Browser....
2.	Select VB - Visual Basic objects and procedures.
3.	Select VBKeyCodeConstants.
4.	Select one of the listed constants.
A description of the constant appears at the bottom of the form.


Visual C++ Key Codes

The following are the Visual C++ key codes:

VK_A through VK_Z are the same as their ASCII equivalents: 'A' thru 'Z'.
VK_0 through VK_9 are the same as their ASCII equivalents: '0' thru '9'.
VK_LBUTTON
VK_RBUTTON
VK_CANCEL
VK_MBUTTON
VK_BACK
VK_TAB
VK_CLEAR
VK_RETURN
VK_SHIFT
VK_CONTROL
VK_MENU
VK_PAUSE
VK_CAPITAL
VK_ESCAPE
VK_SPACE
VK_PRIOR
VK_NEXT
VK_END
VK_HOME
VK_LEFT
VK_UP
VK_RIGHT
VK_DOWN
VK_SELECT
VK_PRINT
VK_EXECUTE
VK_SNAPSHOT
VK_INSERT
VK_DELETE
VK_HELP

VK_NUMPAD0
VK_NUMPAD1
VK_NUMPAD2
VK_NUMPAD3
VK_NUMPAD4
VK_NUMPAD5
VK_NUMPAD6
VK_NUMPAD7
VK_NUMPAD8
VK_NUMPAD9
VK_MULTIPLY
VK_ADD
VK_SEPARATOR
VK_SUBTRACT
VK_DECIMAL
VK_DIVIDE
VK_F1
VK_F2
VK_F3
VK_F4
VK_F5
VK_F6
VK_F7
VK_F8
VK_F9
VK_F10
VK_F11
VK_F12
VK_F13
VK_F14
VK_F15
VK_F16
VK_F17
VK_F18
VK_F19
VK_F20
VK_F21
VK_F22
VK_F23
VK_F24
VK_NUMLOCK
VK_SCROLL


Document/Medical Support and Licensing Requirements

Document/Medical Licensing and Royalty Agreements:

Congratulations!  You have licensed one of the LEADTOOLS Document/Medical software products, the most comprehensive imaging toolkits on the market, enabling you to create powerful imaging applications. The license terms for LEADTOOLS Document Imaging, LEADTOOLS Document Imaging Suite, LEADTOOLS Medical Imaging and LEADTOOLS Medical Imaging Suite require runtime licensing based on the number of copies of your application that you deploy (i.e., distribute or install and use internally).

By paying the initial box price for the applicable LEADTOOLS product, you have obtained a development license, which entitles you to develop your application and test it. Once completed, if you wish to distribute the application or deploy it internally on multiple machines, you are required to enter into a duplication and distribution agreement with LEAD. You have the ability to choose from several licensing options depending on your volume needs.

The product you are installing is a fully functional working version and includes support for all features in LEADTOOLS Document Imaging, LEADTOOLS Document Imaging Suite, LEADTOOLS Medical Imaging and LEADTOOLS Medical Imaging Suite. (Depending on which product you have licensed, some of the features may ultimately not be available to you.  See the on-line help file for a product feature comparison.)  Until you sign and return the correct licensing agreement, your application will display a "nag" message.  Once LEAD receives the executed contract, we will provide you a password that will permit you to terminate the "nag" message for the product that you have licensed. In addition to providing the password, you must also use the no nag version of the LTKRN14N.DLL, found in the REDIST\NONAGLTKRN directory. This is also the version you must redistribute.

Duplication and Distribution Agreements

	Click this button to start a new WinHelp session to review the License Agreements governing your use of the software.


Files To Be Included With Your Application

Note: You may not copy or redistribute any of the following files without obtaining the proper license.

Note: You may not provide software development capabilities in your application. In particular, this means that you must not distribute the LTOCX14.LIC license file.

The following table summarizes the files you must include on your distribution diskettes to support the LEADTOOLS functions on a WIN32 system. (\REDIST subdirectory contains copies of these files.)

Please note that LTKRN, LTDIS, LTEFX, LTIMG, and LTFIL are required for ALL OCX applications. For more information on LTKRN, LTDIS, LTEFX, LTIMG, LTFIL, or other files for the Main Control, refer to Files To Be Included With Your Application

Redistributables:	Explanation:	If you are using a standard release, the files to use are:	If you are using an evaluation release, the files to use are:
LTBAR	Barcode Control and Support DLL AX6R32N.DLL is for Reading PDF417 barcodes (2D).  AX6W32N.DLL is for Writing PDF417 barcodes (2D). AXBAR32N.DLL is for Reading and Writing Linear barcodes (1D). AX7R32N.DLL is for Reading Data Matrix barcodes (2D). AX7W32N.DLL is for Writing Data Matrix barcodes (2D).	DLL: LTBAR14N.DLL AX6R32N.DLL AX6W32N.DLL AXBAR32N.DLL AX7R32N.DLL AX7W32N.DLL OCX: LTBAR14N.OCX	DLL: LTBAR14E.DLL AX6R32N.DLL AX6W32N.DLL AXBAR32N.DLL AX7R32N.DLL AX7W32N.DLL OCX: LTBAR14E.OCX


System Files Updated

The LEADTOOLS installation procedure adds the DLL files and all of the required driver files to your WINDOWS\SYSTEM directory. For a list of these files, refer to Files To Be Included With Your Application.

In addition, the installation procedure, as noted in the remainder of this topic, updates Windows system files that are required by the LEADTOOLS example programs.

The LEADTOOLS WIN32 installation procedure adds the following Windows files to your WINDOWS\SYSTEM directory. If your system has an earlier version of any of these files, the installation procedure overwrites it with the newer version.

COMDLG32.OCX
CTL3D32.DLL
MFC40.DLL
MFC42.DLL
MSVCRT20.DLL
MSVCRT40.DLL
MSVCRT.DLL
OC30.DLL
OLE32.DLL
OLEAUT32.DLL
OLEPRO32.DLL
STDOLE2.TLB
VB40032.DLL
VEN2232.OLB


Example Programs

Note:	You can run some of the example programs on your system by clicking the appropriate buttons in online help. An error message will appear if you try to run an example program that is not on your system.
The executable files for these examples were compiled with Document/Medical capabilities of the toolkit. To get Document/Medical capabilities, you must buy a LEADTOOLS Document/Medical toolkit. Otherwise, if you recompile the examples, the resulting executable files will not have the Document/Medical capabilities.

Visual Basic

 EXAMPLES\OCX\VB\BARCOD32 contains a sample application that demonstrates most of the Barcode capabilities in Visual Basic 5.0. To run the 32-bit sample application, you can run the EXE file in LEAD's BIN directory.

Visual C++ 4.0

 EXAMPLES\OCX\MFC40\BARCODE contains a sample application that demonstrates most of the Barcode capabilities in Visual C++ 4.0. You can open the project in Visual C++; then compile and run it.


Using the Barcode Demos

This document describes how to use the basic features of the "LEADTOOLS Barcode Demos".

You will find the following features in the Barcode demos:

1.	The ability to save your image to any output file format supported by LEAD Technologies, Inc.
2.	Support for reading and writing different types of barcodes.
3.	The ability to save the results obtained from reading barcodes into a Log file.
4.	Support for Twain and ISIS scanning
5.	The ability to write different barcodes using different colors.
LEAD also includes two step-by-step tutorials for reading barcodes and writing a barcode using this demo. For more information on these, refer to Reading Barcodes Using the Barcode Demo and Writing Barcodes Using the Barcode Demo.

The barcode demos demonstrate the Barcode toolkit features. They let you read several barcode types from an image, or write barcodes over an image using different options.

Supported Image Formats

The LEADTOOLS Barcode toolkit supports all image file formats supported by LEADTOOLS.

Getting Started with the LEADTOOLS Barcode Demos

To start a LEADTOOLS Barcode Demo, you can do one of the following:

1.	Select "Start" -> "Programs" -> "LEADTOOLS Raster Imaging Pro 14.5" -> "Extensions" -> "Barcode" -> "ActiveX" or "API" or "C++ Class Library" and click on the desired demo, as shown below.
	Please note that your exact path may vary, depending on the toolkit you have installed.
OR

2.	Double click on one of the .EXE files listed below. These .EXE files can be found in the LEAD/Bin directory, where LEAD represents the directory in which you installed the toolkit.
 MFCBar32.exe

 ClBar32.exe

 VBBar32.exe

 OCBar40.exe

Barcode API Demo – Main Window

The following displays the Main Window for the "Barcode ActiveX MFC Demo", the "Barcode API MFC Demo" and the "Barcode Class Lib Demo":

The following displays the Main Window for the "Barcode ActiveX VB Demo" and the "Barcode API Demo":

Menus

The LEADTOOLS Barcode Demo contains the following menus:

 File Menu

 Edit Menu

 Actions Menu

 Window Menu

 Help Menu

Click on each menu for more detailed information.

File Menu

This menu contains the following items:

New: Creates a new image. This option is available only in the "Barcode API MFC Demo", the "Barcode ActiveX MFC Demo" and the "Barcode Class Lib Demo". The new image is created using the width and height specified in the dialog shown below:

Open: Opens an image in which to find existing barcodes or write new barcodes.

Close: Closes the active child window.

Save As: Saves the active image to a physical file.

TWAIN Select: Selects a TWAIN source using the following dialog:

TWAIN Acquire: Opens the TWAIN source user interface to acquire barcode images.

ISIS Select: Selects an ISIS source using the following dialog:

ISIS Acquire: Opens the ISIS source user interface to acquire barcode images.

Exit: Ends the application.

Edit Menu

This menu contains the following items:

Copy: Copies the active image to the clipboard.

Paste: Pastes the clipboard contents to a new child window.

Actions Menu

This menu contains the following items:

Read: Brings up the Read Options dialog. This dialog is used to set the search criteria used when searching for barcodes in the active window. For more information, please refer to Read Options Dialog.

Write: Brings up the Write options dialog. This dialog is used to set the write criteria used when writing a barcode over the active window. For more information, please refer to Write Options Dialog.

Duplicated Info: Brings up a sub menu for finding the duplicated barcodes in the active window. The following shows the sub menu:

This sub menu contains the following items:

Get First: Brings up the Duplicated Index dialog, shown below. This dialog is used to enter the index for the barcode, for which to find a duplicate.

If the barcode toolkit finds a duplicated barcode, then the demo will display the information for the duplicated barcode as shown below. Otherwise, the demo will bring up an error.

Get Next: Finds the next duplicated barcode, if one exists. Otherwise, the demo will bring up an error.

The following menu items are available only in the "Barcode API MFC Demo" the "Barcode ActiveX MFC Demo", and the "Barcode Class Lib Demo":

Set Log File: Brings the Set Log File Name dialog. This dialog is used to set the path for the Log File. When barcodes are read, the results are placed in this file. The following shows the dialog:

Open Log File: Opens the Log File. This menu item is enabled only after the setting a log file in using the Set Log File menu item and reading the barcodes. Selecting this menu item displays the Log File, as shown below:

Window Menu

This menu contains the following items:

Close All: Closes all child windows.

Cascade: Arranges all child windows in cascade style.

Tile: Arranges all child windows in Tile style.

Arrange Icons: Arranges all child windows as icons.

Help Menu

This menu contains the following item:

About: Brings up the About BarDemo dialog, shown below.


Read Options Dialog

The Read Options dialog is shown below:

This dialog contains the following major options:

1.	General Group:
	a.	Symbol Types: Opens the drop-down list box, shown below, which is used to select the type of symbol to read.
		- Bar Codes: Reads linear barcodes.
		- PDF417: Reads PDF417 barcodes.
		- Data Matrix: Reads Data Matrix barcodes.
	b.	Multiple Max: Determines the maximum number of barcodes to find.
	c.	Units: Determines the unit of measure for reading barcodes. The available units are shown below:
2.	Search Flags Group: Specifies the barcode sub-types for which to search and whether to search a region or an area.
	The type selected in the Symbol Type drop-down list box determines what Search Flag options are available. These are displayed below for each symbol type:
	Linear barcode	PDF417	Data Matrix
	To see the barcode sub-types for each major type, please refer to the image in the "Symbol Types" section above.
	a.	Using the Region: Indicates whether to read barcodes in the region of the image or in the area defined by the Location Group options. When this is checked, the demo will read the barcodes within the region and all options in the Location Group will be disabled.
	b.	Search All Types: Indicates whether to search for all barcode types. If this is checked, the individual types present in the Search Flags Group will be disabled.
	c.	Individual barcode types: Indicates an individual type of barcode for which to search. These are disabled if the Search All Types option is checked.
3.	Location Group: Specifies the search area in which to find the barcodes. To specify the area, set the following members:
	a.	StartX
	b.	StartY
	c.	Width
	d.	Height
	This area will be used only if the "Using the Region" option, under "Search Flags", is not checked.
4.	Direction Group: Specifies the direction of the search. These options will be used only with Linear and PDF417 barcodes.
5.	Options Group: Includes options used for reading Linear barcodes. These options include the following:
	a.	Error Check Digit: Enables or disables the use of an error check digit while reading or writing a barcode.
	b.	Minimum Length: Specifies the minimum length of a barcode string when searching for a non-fixed-length barcode.
	c.	Granularity: Specifies the number of lines per column to skip when reading a barcode. The default value is 9. This means that every tenth line will be scanned when looking for a barcode. Scanning every line slows the process while skipping too many lines may skip a barcode.
	d.	White Lines: Specifies the number of lines of white space above and below the barcode symbol.
6.	Colors Group: Specifies which colors, if any, to use when searching for barcodes. The following are the color options:
	a.	Use Color: Enables reading barcodes with colors. If this is unchecked, the demo will use the default barcode color, BLACK, and the default space color, WHITE.
	b.	Bar Color: Specifies the bar color to use when searching for barcodes. Barcodes that are not this color will not be found.
	c.	Space Color: Specifies the space color to use when searching for barcodes. Barcodes that do not have spaces this color will not be found.
7.	OK button: Starts a barcode search of the image, using the read criteria set in this dialog. If the image contains any barcodes that match the read criteria, then the demo will display the number of barcodes found in a dialog box, and will display information for each barcode in a separate dialog box.
8.	Cancel button: Cancels the barcode search and closes the dialog.


Write Options Dialog

The Write Options dialog is shown below:

This dialog contains the following major options:

1.	General Group:
	a.	Symbol Type: Opens the drop-down list box, shown below, which is used to select the type of symbol to write.
		- Bar Codes: Reads linear barcodes.
		- PDF417: Reads PDF417 barcodes.
		- Data Matrix: Reads Data Matrix barcodes.
		Note: The type selected in the Symbol Type drop-down list box determines what options are available throughout the rest of the dialog.
	b.	Barcode Type: Specifies the barcode sub-type to write.
	c.	Units: Determines the unit of measure for reading barcodes. The available units are shown below:
2.	Location Group: Specifies the area in which to write the barcode. To specify the area, set the following members:
	a.	StartX
	b.	StartY
	c.	Width
	d.	Height
	This area will be used only if you didn’t select a region in the image. If you did select a region, then the demo will write the barcode within the region and ignore this area.
3.	Options Group: Contains flags that indicate whether to write an error check digit and the text for the barcode. For more information, please refer to the rest of the Barcode help file.
4.	Colors Group: Specifies colors that will be used for searching. The following are the color options:
	a.	Use Color: Enables writing barcodes with colors. If this is unchecked, the demo will use the default barcode color, BLACK, and the default space color, WHITE to write the barcode.
	b.	Transparent: Enables writing barcode with a transparent color. This option is not recommended because the written barcodes can’t be read with all images.
	c.	Bar Color: Specifies the bar color to use when writing barcodes.
	d.	Space Color: Specifies the space color to use when writing barcodes.
5.	Bar Code String Group: Specifies the barcode string to write.
6.	Justification Group: Specifies how to justify the barcode within the area. These options will be used only with PDF417 and Data Matrix barcodes. For more information about these options, please refer to the rest of the Barcode help file.
7.	Data Matrix Options Group: Contains options available only when writing Data Matrix barcodes. For more information on Data Matrix options, refer to the rest of the Barcode help file.
8.	PDF417 Options Group: Contains options available only when writing PDF417 barcodes. For more information on PDF417 options, refer to the rest of the Barcode help file.
9.	OK button: Writes a barcode over the image, using the write criteria set in this dialog.
10.	Cancel button: Cancels writing the barcode and closes the dialog.


Reading Barcodes Using the Barcode Demo

Please note that even though these tutorials use the Barcode API MFC demo, you can follow the same basic steps for any of the Barcode demos.

1.	Start the demo by:
	Selecting "Start" -> "Programs" -> "LEADTOOLS Raster Imaging Pro 14.5" -> "Extensions" -> "Barcode" -> "ActiveX" or "API" or "C++ Class Library" and click on the desired demo, as shown below.
	Please note that your exact path may vary, depending on the toolkit you have installed.
	or
	Double clicking on the MFCBar32.exe file in the LEAD/BIN directory, where LEAD represents the directory in which you installed the LEADTOOLS toolkit. (If you used the default settings when you installed the toolkit, that path would be "C:\Program Files\LEAD Technologies, Inc\LEADTOOLS\Bin".)
2.	In the main window of the Bar Code Demo, select File -> Open.
3.	In the Open dialog, you can either set the path to the LEAD/Images directory in the "File" edit box or browse to this directory using the "Look in" drop box. (Please note that in the LEAD/Images directory mentioned above, "LEAD" represents the directory in which you installed the LEADTOOLS toolkit.) Select the barcode1.tif file and select Open.
4.	In the main window of the Bar Code Demo, select Actions -> Read …. The Bar Code Read Options dialog will appear, as shown below:
5.	Use the settings shown above. Notice that when the "Search All Types" box is checked, the boxes for the individual barcode types are disabled.
6.	Press OK in the Bar Code Read Options dialog.
7.	A "Notice!" message box will appear with information on the number of barcodes found. Click OK.
8.	Next a dialog will appear for each barcode found. Each dialog will display information about the barcode. Click OK on the dialog to display the dialog for the next barcode.


Writing Barcodes Using the Barcode Demo

Please note that even though these tutorials use the Barcode API MFC demo, you can follow the same basic steps for any of the Barcode demos.

1.	Start the demo by:
	Selecting "Start" -> "Programs" -> "LEADTOOLS Raster Imaging Pro 14.5" -> "Extensions" -> "Barcode" -> "ActiveX" or "API" or "C++ Class Library" and click on the desired demo, as shown below.
	Please note that your exact path may vary, depending on the toolkit you have installed.
	or
	Double clicking on the MFCBar32.exe file in the LEAD/BIN directory, where LEAD represents the directory in which you installed the LEADTOOLS toolkit. (If you used the default settings when you installed the toolkit, that path would be "C:\Program Files\LEAD Technologies, Inc\LEADTOOLS\Bin".)
2.	In the main window of the Bar Code Demo, select File -> Open.
3.	In the Open dialog, you can either set the path to the LEAD/Images directory in the "File" edit box or browse to this directory using the "Look in" drop box. Select the barcode1.tif file and select Open.
4.	In the main window of the Bar Code Demo, select Actions -> Write …. The Bar Code Write Options dialog will appear, as shown below:
5.	Use the settings shown above.
6.	Press OK in the Bar Code Write Options dialog.
7.	The new barcode will appear on the image.


Tutorial for Visual C++ 4.0 Programmers

The following topics provide brief and simple examples to help you learn how to use the LEADTOOLS Barcode ActiveX. Note that the ActiveX requires the MFC 4.2 files, which are described in System Files Updated.

For general information about the syntax requirements of this interface, refer to Visual C++ 4.0 Syntax.

Reading Barcodes

Writing Barcodes

Finding Duplicated Barcodes

Miscellaneous Examples


Reading Barcodes (Visual C++ 4.0)
Reading Barcodes (C++ 4.0 and later)

Take the following steps to start a project and to add some code that searches for barcodes in a bitmap.

1.	Start a new project as follows:
	For C++ 4.x, run Microsoft Developer Studio for Visual C++, select the File >New menu option, select Project Workspace, and click the OK button. In the New Project Workspace dialog box, do the following:
	a.	In the Type list box, select MFC AppWizard (exe).
	b.	In the Name text box, specify BarTutor.
	c.	In the Location text box, specify the path of the project.
	d.	In the Platforms list box, check Win32.
	e.	Click the Create button.
	For C++ 5.0, run Microsoft Visual C++ 5.0, select the File >New menu option, and do the following:
	a.	Click the Projects tab.
	b.	Select MFC AppWizard (exe) as the project type
	c.	In the Project name text box, specify BarTutor.
	d.	In the Location text box, specify the path of the project.
	e.	Click the OK button.
2.	In the Step 1 dialog box, do the following:
	a.	Select Dialog based.
	b.	Click the Next button.
3.	In the Step 2 of 4 dialog box, do the following:
	a.	Ensure that About Box is selected.
	b.	Ensure that 3D Controls is selected.
	c.	Select OLE Controls (ActiveX Controls in 5.0).
	d.	Click the Next button.
4.	In the Step 3 of 4 dialog box, do the following:
	a.	For comments, ensure that Yes, Please is selected.
	b.	For how to use the MFC library, select As a statically linked library.
	c.	Click the Next button.
5.	In the Step 4 of 4 dialog box, just click Finish.
6.	Read New Project Information, and click OK. (The AppWizard creates the project files and opens the project.)
7.	Add the L_OCX40.H file, L_OcxErr.H file and the ltBarocx.h file, to your project as follows:
	a.	Copy the L_ocx40.h file, l_ocxerr.h file and the ltBarocx.h file to your project directory, from the \lead\include\ directory.
	b.	In the Project Workspace, click the FileView tab.
	c.	Double-click the BarTutor files folder to open it.
	d.	Double-click the Dependencies folder (the Header Files folder in 5.0) to open it.
	e.	Double-click the StdAfx.h file to edit it.
	f.	Add the following lines to the end of the file:
#include "L_OCX40.H"
#include "ltBarocx.h"

8.	Add a LEAD control to the main window as follows:
	For C++ 4.x:
	a.	In the Project Workspace, click the ResourceView tab.
	b.	Double-click the BarTutor resources folder to open it.
	c.	Double-click the Dialog folder to open it.
	d.	Double-click IDD_BARTUTOR_DIALOG to design the dialog box.
	e.	Select the TODO... text control; then press the Delete key to delete it.
	f.	From the main menu, select Insert > Component. (The Component Gallery appears.)
	g.	Click the OLE controls tab.
	h.	Double-click the LEAD Main Control (14.5) icon. (The Confirm Classes dialog box appears.)
	i.	Ensure that CLead is checked.
	j.	Click OK to complete the selection.
	k.	Double-click the LEAD Bar Code Control (14.5) icon. (The Confirm Classes dialog box appears.)
	l.	Ensure that CLEADBarCode, CBARCODEDATA, CLinearBar, CCODEONEWrite, CDATAMATRIXWrite, CPDFRead, and CPDFWrite are checked.
	m.	Click OK to complete the selection; then click Close to close the Component Gallery. (The LEAD controls appear in the controls toolbar.)
	n.	Click the LEAD Control icon on the toolbar; then size and position the control as you want it to appear at run time.
	o.	Double-click the new LEAD Control to edit its properties.
	p.	Change the ID to IDC_LEAD1.
	q.	Click the LEAD Bar Code Control icon on the toolbar, and add it to the main window.
	r.	Double click the new LEAD Bar Code Control to edit its properties.
	s.	Change the ID to IDC_LEADBARCODE1.
	For C++ 5.0:
	a.	In the Project Workspace, click the ResourceView tab.
	b.	Double-click the BarTutor resources folder to open it.
	c.	Double-click the Dialog folder to open it.
	d.	Double-click IDD_BARTUTOR_DIALOG to design the dialog box.
	e.	Select the TODO... text control; then press the Delete key to delete it.
	f.	From the main menu, select Project > Add To Project > Components and controls.
	g.	Select Registered ActiveX controls.
	h.	Double-click the LEAD Main Control (14.5) icon. (The Confirm Classes dialog box appears.)
	i.	Ensure that CLead is checked.
	j.	Click OK to complete the selection.
	k.	Double-click the LEAD Bar Code Control (14.5) icon. (The Confirm Classes dialog box appears.)
	l.	Ensure that CLEADBarCode, CBARCODEDATA, CLinearBar, CCODEONEWrite, CDATAMATRIXWrite, CPDFRead, and CPDFWrite are checked.
	m.	Click OK to complete the selection; then click Close to close the Component Gallery. (The LEAD controls appear in the controls toolbar.)
	n.	Click the LEAD Main Control icon on the toolbar; then size and position the control as you want it to appear at run time.
	o.	Use the right mouse button to edit the properties of the new LEAD Main Control.
	p.	Change the ID to IDC_LEAD1.
	q.	Click the LEAD Bar Code Control icon on the toolbar and add it to the main window.
	r.	Use the right mouse button to edit the properties of the new LEAD Common Dialog control.
	s.	Change the ID to IDC_LEADBARCODE1.
9.	Add two command buttons to your form and name them as follows:
	Name	Caption
	IDC_LOADLEAD	Load Image
	IDC_READBARBTN	Read Bar Code
10.	Press Ctrl-F4 to close all windows back to the Project Workspace.
11.	Do the following to add m_LEAD1 and m_LEADBar1 to the CBarTutorDlg class and link the variable to the controls using dynamic data exchange:
	a.	Press Ctrl-W. (The MFC ClassWizard dialog box appears.)
	b.	Click the Member Variables tab.
	c.	In the Class Name box, select CBarTutorDlg.
	d.	In the Control IDs list, select IDC_LEAD1.
	e.	Click the Add Variable... button.
	f.	Specify m_LEAD1 as the variable name, and control as the category.
	g.	Click OK to close the dialog box.
	h.	Back in MFC Wizard, go to the Member Variables tab, and ensure CBarTutorDlg is in the Class Name box.
	i.	In the Control IDs list, select IDC_LEADBARCODE1.
	j.	Click the Add Variable... button.
	k.	Specify m_LEADBar1 as the variable name, and control as the category.
	l.	Click OK to close the dialog box, and click OK to close the MFC ClassWizard.
12.	Press Ctrl-W to go to the MFC Class Wizard; then do the following:
	a.	Click the Message Maps tab.
	b.	In the Class Name combo box, select CBarTutorDlg.
	c.	In the Object IDs list box, select IDC_LOADLEAD.
	d.	In the Messages list box, select BN_CLICKED.
	e.	Click the Add function button. Choose OK for the default function name (OnLoadLead).
	f.	Click the Edit Code button and enter the following code:
m_LEAD1.Load("LEAD\\images\\barcode1.tif", 0, 0, 1);

13.	Edit the BarTutorDlg.h file and insert the following line in the definition of CBarTutorDlg class, just after protected implementation section:
void DisplayBarCodeInfo(int nIndex);

14.	Edit the BarTutorDlg.cpp and insert the following lines:
	a.	Insert the following lines to the includes section in the file:
#include "barcodedata.h"
#include "linearbar.h"

	b.	Insert the following implementation function to the end of file:
void CBarTutorDlg::DisplayBarCodeInfo(int nIndex)
{
   CString csOutBuffer;
   LPCTSTR lpctstrBuffer = csOutBuffer.GetBuffer(m_LEADBar1.GetBarCodeData(nIndex).GetData().GetLength() + 256);

   wsprintf((CHAR *)lpctstrBuffer, "No. %d\nData is %s\nType %i\nUnits %i\nPosX %d\nPosY %d\nWidth %d\nHeight %d\n\n",
            nIndex,
            m_LEADBar1.GetBarCodeData(nIndex).GetData(),
            m_LEADBar1.GetBarCodeData(nIndex).GetType(),
            m_LEADBar1.GetBarCodeData(nIndex).GetUnits(),
            m_LEADBar1.GetBarCodeData(nIndex).GetLeft(),
            m_LEADBar1.GetBarCodeData(nIndex).GetTop(),
            m_LEADBar1.GetBarCodeData(nIndex).GetWidth(),
            m_LEADBar1.GetBarCodeData(nIndex).GetHeight());

   MessageBox(lpctstrBuffer, "BarCode Info.");
   csOutBuffer.ReleaseBuffer();
}

15.	Press Ctrl-W to go to the MFC Class Wizard; then do the following:
	a.	Click the Message Maps tab.
	b.	In the Class Name combo box, select CBarTutorDlg.
	c.	In the Object IDs list box, select IDC_READBARBTN.
	d.	In the Messages list box, select BN_CLICKED.
	e.	Click the Add function button. Choose OK for the default function name (OnReadbar).
	f.	Click the Edit Code button and enter the following code:
   CString csBarMsg;

/* Unlock linear barcodes support.
       Note that this is a sample key, which will not work in your toolkit */

   m_LEADBar1.UnlockSupport(L_SUPPORT_BARCODES_1D, "TestKey");

   m_LEADBar1.SetBitmap(m_LEAD1.GetBitmap());
   m_LEADBar1.SetEnableMethodErrors(FALSE);
   m_LEADBar1.SetEnableUseRegion(TRUE);

   m_LEADBar1.GetLinear().SetEnableErrorCheck(TRUE);
   m_LEADBar1.GetLinear().SetGranularity(9);
   m_LEADBar1.GetLinear().SetReadDirection(BARCODE_DIR_LEFT_TO_RIGHT);

   /* The Read method will search for all linear barcodes in the whole bitmap */
   int nRet = m_LEADBar1.Read(BARCODE_1D_READ_ANYTYPE, 0, 0, 0, 0, 0);

   if (nRet == 0)
   {
      csBarMsg.Format("Total Bar Code Symbols Found = %d\n", m_LEADBar1.GetTotalCount());
      MessageBox((LPCTSTR)csBarMsg, "Bar Code Count");

      for (int i = 0; i < m_LEADBar1.GetTotalCount(); i++)
         DisplayBarCodeInfo(i);
   }
   else
   {
      csBarMsg.Format("Error occurred in the Read method. Error No. = %d\n", nRet);
      MessageBox((LPCTSTR)csBarMsg, "Error!");
   }
   m_LEADBar1.SetBitmap(0); /* release the reference to the bitmap */

16.	On the main menu, select Build> Build BarTutor.exe to build the project.
17.	On the main menu, select Build> Execute BarTutor.exe to run the project.


Writing Barcodes (Visual C++ 4.0)
Writing Barcodes (C++ 4.0 and later)

Take the following steps to add some code that Writes a Bar Codes over the bitmap:

1.	Start with the project that you created in Reading Bar Codes Tutorial for Visual C++.
2.	Go to the Project WorkSpace and click the ResourceView tab.
3.	Double-click Dialog and double-click IDD_BARTUTOR_DIALOG to bring up the application's dialog box.
4.	Add a command button to your form and name it as follows:
	Name	Caption
	IDC_WRITEBARBTN	Write Bar Code
5.	Press Ctrl-F4 to close all windows back to the Project Workspace.
6.	Press Ctrl-W to go to the MFC Class Wizard; then do the following:
	a.	Click the Message Maps tab.
	b.	In the Class Name combo box, select CBarTutorDlg.
	c.	In the Object IDs list box, select IDC_WRITEBARBTN.
	d.	In the Messages list box, select BN_CLICKED.
	e.	Click the Add function button. Choose OK for the default function name (OnWritebarbtn).
	f.	Click the Edit Code button and enter the following code:
   /* Unlock linear barcodes support.
       Note that this is a sample key, which will not work in your toolkit */
   m_LEADBar1.UnlockSupport(L_SUPPORT_BARCODES_1D, "TestKey");
   m_LEADBar1.SetBitmap(m_LEAD1.GetBitmap());

   m_LEADBar1.SetUnits(BARCODE_INCHES);
   m_LEADBar1.GetLinear().SetEnableErrorCheck(TRUE);
   m_LEADBar1.GetLinear().SetEnableWriteText(TRUE);

   int nRet = m_LEADBar1.Write(BARCODE_1D_EAN_13, "012345678901", 100, 100, 100, 50);
   if (nRet == 0)
      m_LEAD1.ForceRepaint
   else
   {
      CString strErrMsg;
      strErrMsg.Format("Error Occurred in Write method, Error No. = %d\n", nRet);
      MessageBox((LPCTSTR)strErrMsg, "Error!");
   }
   m_LEADBar1.SetBitmap(0); /* release the reference to the bitmap */

7.	Rebuild and run the application.


Finding Duplicated Barcodes (Visual C++ 4.0)
Finding Duplicated Barcodes (C++ 4.0 and later)

Take the following steps to add code that can find a duplicated barcodes in the bitmap.

1.	Start with the project that you created in Reading Bar Codes Tutorial for Visual C++.
2.	Go to the Project WorkSpace and click the ResourceView tab.
3.	Double-click Dialog and double-click IDD_BARTUTOR_DIALOG to bring up the application's dialog box.
4.	Add a command button to your form and name it as follows:
	Name	Caption
	IDC_FINDDUPBAR	Find Duplicate
5.	Press Ctrl-F4 to close all windows back to the Project Workspace.
6.	To add code for the Find Duplicate button, press Ctrl-W to go to the MFC Class Wizard; then do the following:
	a.	Click the Message Maps tab.
	b.	In the Class Name combo box, select CBarTutorDlg.
	c.	In the Object IDs list box, select IDC_FINDDUPBAR.
	d.	In the Messages list box, select BN_CLICKED.
	e.	Click the Add function button. Choose OK for the default function name (OnFinddupbar).
	f.	Click the Edit Code button, and enter the following code:
   CString cstrMsg;
   if (m_LEADBar1.IsDuplicated(4))
   {
      int nDupIndex = m_LEADBar1.GetFirstDuplicated(4);

      if (nDupIndex >= ERROR_FAILURE)
      {
         cstrMsg.Format("Error occurred in the GetFirstDuplicated method. Error No. = %d\n", nDupIndex);
         MessageBox((LPCTSTR)cstrMsg, "Error!");
      }
      else
      {
         /* Display the first duplicate barcode information. */
         DisplayBarCodeInfo(nDupIndex);

         nDupIndex = m_LEADBar1.GetNextDuplicated(nDupIndex);
         if (nDupIndex >= ERROR_FAILURE)
         {
            cstrMsg.Format("Error occurred in the GetNextDuplicated method. Error No. = %d\n", nDupIndex);
            MessageBox((LPCTSTR)cstrMsg, "Error!");
         }
         else
            /* Display the next duplicate barcode information. */
            DisplayBarCodeInfo(nDupIndex);
      }
   }
   else
   {
      cstrMsg.Format("This Barcode is not duplicated ...");
      MessageBox((LPCTSTR)cstrMsg, "Error!");
   }

7.	Rebuild and run the application.


Miscellaneous Examples (Visual C++ 4.0)
Miscellaneous Examples (C++ 4.0 and later)

You can test any of the following examples by adding a command button and pasting the sample code in the Click procedure.

EnableGetSizeMethod example for C++ 4.0 and later

GetFirstDuplicated Example for C++ 4.0 and later

PDFRead example for C++ 4.0 and later

PDFWrite Example for C++ 4.0 and later

QRWrite example for C++ 4.0 and later

Read Example for C++ 4.0 and later

UnlockSupport example for C++ 4.0 and later

Write example for C++ 4.0 and later


EnableGetSizeMethod example for C++ 4.0 and later

void CBarTutorDlg::OnGetBarSize()
{
   CLEADBarCode m_LeadBar1;
   CLead m_LEAD;

   BeginWaitCursor();

   CHAR szBuffer[256];
   memset(szBuffer, 0, sizeof(szBuffer));

   /* Unlock Data Matrix write support.
      Note that this is a sample key, which will not work in your toolkit */

   // m_LeadBar.UnlockSupport (L_SUPPORT_BARCODES_DATAMATRIX_WRITE, "TestKey");
   m_LeadBar1.SetBitmap(m_LEAD.GetBitmap ());

   m_LeadBar1.SetUnits (BARCODE_SCANLINES_PER_PIXELS);
   m_LeadBar1.SetWriteFlags(BARCODE_INITREADER | BARCODE_DISABLE_COMPRESSOPN);

   m_LeadBar1.GetDataMatrixWrite().SetFlags(BARCODE_JUSTIFY_RIGHT);
   m_LeadBar1.GetDataMatrixWrite().SetFileIDHigh(1);
   m_LeadBar1.GetDataMatrixWrite().SetFileIDLow(1);
   m_LeadBar1.GetDataMatrixWrite().SetGroupNumber(0);
   m_LeadBar1.GetDataMatrixWrite().SetGroupTotal(0);
   m_LeadBar1.GetDataMatrixWrite().SetXModule(0);

   m_LeadBar1.SetEnableGetSizeMethod(TRUE);

   int nRet = m_LeadBar1.Write(BARCODE_DM_DEF, "Data Matrix Default", 50, 50, 0, 0);
   if (nRet == 0)
   {
      wsprintf(szBuffer,
               "Barcode Size: \nStartX = %d\nStartY = %d\nWidth = %d\nHeight = %d\n\n",
               m_LeadBar1.GetStartX (),
               m_LeadBar1.GetStartY (),
               m_LeadBar1.GetSizeX (),
               m_LeadBar1.GetSizeY ());
      MessageBox(szBuffer, "Notice!", MB_OK);
   }
   else
   {
      wsprintf(szBuffer, "Error occurred in the Write method. Error No. = %d\n", nRet);
      MessageBox(szBuffer, "Error!", MB_OK);
   }

   m_LeadBar1.SetBitmap(0); // release the reference to the bitmap
   EndWaitCursor();
}


GetFirstDuplicated Example for C++ 4.0 and later

void CBarTutorDlg::OnDup()
{
   BeginWaitCursor();
   CHAR szBuffer[256];
   memset(szBuffer, 0, sizeof(szBuffer));

   if (m_LEADBar1.IsDuplicated(0))
   {
      int nDupCount = m_LEADBar1.GetDuplicatedCount(0);

      wsprintf(szBuffer, "This Bar Code was found in %d different locations.", nDupCount);
      MessageBox( szBuffer, "Notice!", MB_OK);

      memset(szBuffer, 0, sizeof(szBuffer));
      int nDupIndex = m_LEADBar1.GetFirstDuplicated(0);
      if (nDupIndex >= ERROR_FAILURE)
      {
         wsprintf(szBuffer, "Error occurred in the GetFirstDuplicated method. Error No. = %d\n", nDupIndex);
         MessageBox( szBuffer, "Error!", MB_OK);
      }
      else
      {
         // Display the first duplicate barcode information.
         wsprintf(szBuffer, "No. %d\nType %d\nUnits %d\nData is %s\nPosX %d\nPosY %d\nWidth %d\nHeight %d\n\n",
                  nDupIndex,
                  m_LEADBar1.GetBarCodeData(nDupIndex).GetType(),
                  m_LEADBar1.GetBarCodeData(nDupIndex).GetUnits(),
                  m_LEADBar1.GetBarCodeData(nDupIndex).GetData(),
                  m_LEADBar1.GetBarCodeData(nDupIndex).GetLeft(),
                  m_LEADBar1.GetBarCodeData(nDupIndex).GetTop(),
                  m_LEADBar1.GetBarCodeData(nDupIndex).GetWidth(),
                  m_LEADBar1.GetBarCodeData(nDupIndex).GetHeight());

         MessageBox( szBuffer, "BarCode Info.", MB_OK);

         nDupIndex = m_LEADBar1.GetNextDuplicated(nDupIndex);
         if (nDupIndex >= ERROR_FAILURE)
         {
            wsprintf(szBuffer, "Error occurred in the GetNextDuplicated method. Error No. = %d\n", nDupIndex);
            MessageBox( szBuffer, "Error!", MB_OK);
         }
         else
         {
            // Display the next duplicate barcode information.
            memset(szBuffer, 0, sizeof(szBuffer));
            wsprintf(szBuffer, "No. %d\nType %d\nUnits %d\nData is %s\nPosX %d\nPosY %d\nWidth %d\nHeight %d\n\n",
                     nDupIndex,
                     m_LEADBar1.GetBarCodeData(nDupIndex).GetType(),
                     m_LEADBar1.GetBarCodeData(nDupIndex).GetUnits(),
                     m_LEADBar1.GetBarCodeData(nDupIndex).GetData(),
                     m_LEADBar1.GetBarCodeData(nDupIndex).GetLeft(),
                     m_LEADBar1.GetBarCodeData(nDupIndex).GetTop(),
                     m_LEADBar1.GetBarCodeData(nDupIndex).GetWidth(),
                     m_LEADBar1.GetBarCodeData(nDupIndex).GetHeight());

            MessageBox( szBuffer, "BarCode Info.", MB_OK);
         }
      }
   }
   else
   {
      wsprintf(szBuffer, "This Barcode is not duplicated ...");
      MessageBox( szBuffer, "Error!", MB_OK);
   }
   EndWaitCursor();

}


PDFRead example for C++ 4.0 and later

void CBarTutorDlg::OnPdfread()
{
   BeginWaitCursor();
   CHAR szBuffer[256];

   memset(szBuffer, 0, sizeof(szBuffer));

   /* Unlock read PDF barcodes support.
      Note that this is a sample key, which will not work in your toolkit */

   m_LEADBar1.UnlockSupport(L_SUPPORT_BARCODES_PDF_READ, "TestKey");

   m_LEADBar1.SetBitmap(m_LEAD1.GetBitmap ());

   m_LEADBar1.GetPDFRead().SetDirection(BARCODE_DIR_LEFT_TO_RIGHT);

   /*' The Read method will search for the first 5 occurrences of the (PDF 417)
       bar code type in the whole bitmap. */
   int nRet = m_LEADBar1.Read(BARCODE_PDF417, 5, 0, 0, 0, 0);

   if (nRet == 0)
   {
      wsprintf(szBuffer, "Total Bar Code Symbols Found = %d\n", m_LEADBar1.GetTotalCount());
      MessageBox(szBuffer, "Notice!", MB_OK);

      for(int i = 0; i < m_LEADBar1.GetTotalCount(); i++)
      {
         memset(szBuffer, 0, sizeof(szBuffer));
         wsprintf(szBuffer, "No. %d\nType %d\nUnits %d\nData is %s\nPosX %d\nPosY %d\nWidth %d\nHeight %d\n\n",
                  i,
                  m_LEADBar1.GetBarCodeData(i).GetType(),
                  m_LEADBar1.GetBarCodeData(i).GetUnits(),
                  m_LEADBar1.GetBarCodeData(i).GetData(),
                  m_LEADBar1.GetBarCodeData(i).GetLeft(),
                  m_LEADBar1.GetBarCodeData(i).GetTop(),
                  m_LEADBar1.GetBarCodeData(i).GetWidth(),
                  m_LEADBar1.GetBarCodeData(i).GetHeight());

         MessageBox(szBuffer, "BarCode Info.", MB_OK);
      }
   }
   else
   {
      wsprintf(szBuffer, "Error occurred in the Read method. Error No. = %d\n" , nRet);
      MessageBox(szBuffer, "Error!", MB_OK);
   }

   m_LEADBar1.SetBitmap(0);
   EndWaitCursor();

}


PDFWrite Example for C++ 4.0 and later

void CBarTutorDlg::OnPdfwrite()
{
   BeginWaitCursor();

   /* Unlock write PDF barcodes support.
      Note that this is a sample key, which will not work in your toolkit */

   m_LEADBar1.UnlockSupport(L_SUPPORT_BARCODES_PDF_WRITE, "TestKey");
   m_LEADBar1.SetBitmap(m_LEAD1.GetBitmap());

   m_LEADBar1.SetUnits(BARCODE_SCANLINES_PER_PIXELS);
   m_LEADBar1.GetPDFWrite().SetECCLevel(BARCODE_PDF417_ECCUSE_PERCENT);
   m_LEADBar1.GetPDFWrite().SetECCPercent(50);
   m_LEADBar1.GetPDFWrite().SetModule(21);
   m_LEADBar1.GetPDFWrite().SetModuleAspectRatio(4);

   m_LEADBar1.SetWriteFlags(BARCODE_INITREADER | BARCODE_TRUNCATE);

   int nRet = m_LEADBar1.Write(BARCODE_PDF417, "PDF417 Symbol", 100, 100, 0, 0);
   if (nRet == 0)
      m_LEAD1.ForceRepaint ();
   else
   {
      CHAR szBuffer[256];

      memset(szBuffer, 0, sizeof(szBuffer));
      wsprintf(szBuffer, "Error occurred in the Write method. Error No. = %d\n", nRet);
      MessageBox( szBuffer, "Error!", MB_OK);
   }

   m_LEADBar1.SetBitmap(0); // release the reference to the bitmap
   EndWaitCursor();

}


Read Example for C++ 4.0 and later

void CBarTutorDlg::OnRead()
{
   BeginWaitCursor();
   CHAR szBuffer[256];

   memset(szBuffer, 0, sizeof(szBuffer));

   /* Unlock linear barcode support.
      Note that this is a sample key, which will not work in your toolkit */

   m_LEADBar1.UnlockSupport(L_SUPPORT_BARCODES_1D, "TestKey");

   m_LEADBar1.SetBitmap(m_LEAD1.GetBitmap ());
   m_LEADBar1.SetEnableMethodErrors(FALSE);
   m_LEADBar1.SetEnableUseRegion(TRUE);
   m_LEADBar1.SetReadFlags(BARCODE_MARKERS | BARCODE_BLOCK_SEARCH);

   m_LEADBar1.SetSpaceColor(RGB(0, 0, 255));
   m_LEADBar1.SetBarColor(RGB(255, 0, 0));
   m_LEADBar1.SetEnableUseColors(TRUE);

   m_LEADBar1.GetLinear().SetEnableErrorCheck(TRUE);
   m_LEADBar1.GetLinear().SetGranularity(9);
   m_LEADBar1.GetLinear().SetReadDirection(BARCODE_DIR_LEFT_TO_RIGHT);

   /* The Read method will search for the first 10 occurrences of (EAN 13) barcodes
      in the bitmap region, if the bitmap has a region. If the bitmap does not have a region,
      the Read method will search for (EAN 13) barcodes in the whole bitmap */

   int nRet = m_LEADBar1.Read(BARCODE_1D_EAN_13, 10, 0, 0, 0, 0);

   if (nRet == 0)
   {
      wsprintf(szBuffer, "Total Bar Code Symbols Found = %d\n", m_LEADBar1.GetTotalCount());
      MessageBox( szBuffer, "Notice!", MB_OK);

      for(int i = 0; i < m_LEADBar1.GetTotalCount(); i++)
      {
         memset(szBuffer, 0, sizeof(szBuffer));
         wsprintf(szBuffer, "No. %d\nType %d\nUnits %d\nData is %s\nPosX %d\nPosY %d\nWidth %d\nHeight %d\n\n",
                  i,
                  m_LEADBar1.GetBarCodeData(i).GetType(),
                  m_LEADBar1.GetBarCodeData(i).GetUnits(),
                  m_LEADBar1.GetBarCodeData(i).GetData(),
                  m_LEADBar1.GetBarCodeData(i).GetLeft(),
                  m_LEADBar1.GetBarCodeData(i).GetTop(),
                  m_LEADBar1.GetBarCodeData(i).GetWidth(),
                  m_LEADBar1.GetBarCodeData(i).GetHeight());

         MessageBox( szBuffer, "BarCode Info.", MB_OK);
      }
   }
   else
   {
      wsprintf(szBuffer, "Error occurred in the Read method. Error No. = %d\n" , nRet);
      MessageBox(szBuffer, "Error!", MB_OK);
   }

   m_LEADBar1.SetBitmap(0);
   EndWaitCursor();

}


UnlockSupport example for Visual C++ 4.0
UnlockSupport example for C++ 4.0 and later

   if (m_LeadBar1.IsSupportLocked(L_SUPPORT_BARCODES_DATAMATRIX_READ))
   {
      /* Unlock Data Matrix Read support.
         Note that this is a sample key, which will not work in your toolkit */
      m_LeadBar.UnlockSupport (L_SUPPORT_BARCODES_DATAMATRIX_READ, "TestKey");
   }


Write example for Visual C++ 4.0
Write example for C++ 4.0 and later

void CBarTutorDlg::OnWrite()
{
   BeginWaitCursor();

   /* Unlock Data Matrix write support.
      Note that this is a sample key, which will not work in your toolkit */

   m_LeadBar.UnlockSupport(L_SUPPORT_BARCODES_DATAMATRIX_WRITE, "TestKey");
   m_LeadBar.SetBitmap(m_LEAD.GetBitmap ());

   m_LeadBar.SetWriteFlags(BARCODE_INITREADER | BARCODE_DISABLE_COMPRESSOPN);
   m_LeadBar.GetDataMatrixWrite().SetFlags(BARCODE_JUSTIFY_RIGHT);

   m_LeadBar.SetUnits(BARCODE_SCANLINES_PER_PIXELS);
   m_LeadBar.SetBarColor(RGB(255, 0, 0));
   m_LeadBar.SetEnableUseColors(TRUE);
   m_LeadBar.SetEnableTransparent(TRUE);

   int nRet = m_LeadBar.Write(BARCODE_DM_DEF, "Data Matrix Default", 100, 100, 0, 0);
   if (nRet == 0)
      m_LEAD.ForceRepaint ();
   else
   {
      CHAR szBuffer[256];

      memset(szBuffer, 0, sizeof(szBuffer));
      wsprintf(szBuffer, "Error occurred in the Write method. Error No. = %d\n", nRet);
      MessageBox( szBuffer, "Error!", MB_OK);
   }

   m_LeadBar.SetBitmap(0); // release the reference to the bitmap
   EndWaitCursor();
}


QRWrite example for C++ 4.0 and later

void CBarCodeView::OnWriteQR()
{
   BeginWaitCursor();

   /* Unlock Data Matrix write support.
      Note that this is a sample key, which will not work in your toolkit */

   m_LeadBar.UnlockSupport (L_SUPPORT_BARCODES_QR_WRITE, "TestKey");
   m_LeadBar.SetBitmap(m_LeadCtrl.GetBitmap());

   m_LeadBar.SetWriteFlags(BARCODE_INITREADER | BARCODE_DISABLE_COMPRESSOPN);
   m_LeadBar.GetQRWrite().SetFlags(BARCODE_JUSTIFY_RIGHT);

   m_LeadBar.SetUnits(BARCODE_SCANLINES_PER_PIXELS);
   m_LeadBar.SetBarColor(RGB(255, 0, 0));
   m_LeadBar.SetEnableUseColors(TRUE);
   m_LeadBar.SetEnableTransparent(TRUE);

   int nRet = m_LeadBar.Write(BARCODE_QR_DEF, "QR Default", 100, 100, 0, 0);
   if (nRet == 0)
      m_LeadCtrl.ForceRepaint ();
   else
   {
      CHAR szBuffer[256];

      memset(szBuffer, 0, sizeof(szBuffer));
      wsprintf(szBuffer, "Error occurred in the Write method. Error No. = %d\n", nRet);
      MessageBox( szBuffer, "Error!", MB_OK);
   }

   m_LeadBar.SetBitmap (0); // release the reference to the bitmap
   EndWaitCursor();
}


Error Codes

For a list of all possible error codes for LEADTOOLS Barcode OCX, refer to LEADTOOLS OCX Error Codes in the Main OCX help file.


Introduction

LEADTOOLS Barcode ActiveX (OCX) provides a custom control developed by LEAD Technologies, Inc.  The LEAD Barcode Control Module provides a custom control for incorporating barcode support into your applications.

In the documentation, the properties, methods and events in the LEAD Barcode Control Module are designated by (LEADBarCode Control).

The toolkit comes as a 32-bit add-on to any Document/Medical product.

You can use the LEADTOOLS Barcode ActiveX in any programming environment that supports ActiveX, including the following:

Visual C++ 4.2 and later
Visual Basic 5.0 and later
Visual FoxPro 6.0
Delphi 6.0

Please note that due to the large size of the PDF files that contain the LEADTOOLS manuals, these files are no longer included in the setup. Instead, these PDF files can be downloaded from our website at http://support.leadtools.com/SupportPortal/DesktopDefault.aspx?tabindex=3&tabid=27.


Programming with the LEADTOOLS ActiveX
Programming with the LEADTOOLS Barcode ActiveX

The following topics provide a systematic approach to understanding and using the LEAD Barcode control's properties, methods, and events:

Registering and Unregistering the ActiveX Controls

Working with Barcodes


Registering and Unregistering the ActiveX Controls

Registering ActiveX Controls

Before the Barcode ActiveX Control can be used, it must be registered.  The installation program automatically registers all the LEADTOOLS Controls.  If you would like to manually register the controls run:

REGSVR32.EXE for 32-bit ActiveXs

found in the BIN directory and pass the name of the ActiveX to register as a parameter.

EX.:

REGSVR32 LTBAR14N.OCX will register the Barcode ActiveX.

Unregistering ActiveX Controls

To unregister the Barcode ActiveX Control, include the "/u" switch before the ActiveX name when running:

REGSVR32.EXE for 32-bit ActiveXs

EX.:

REGSVR32 /u LTBAR14N.OCX will unregister the Barcode ActiveX.

NOTE: The LEADTOOLS ActiveXs do not register without certain DLLs.  For a full list of required DLLs for the Main Controls, refer to Files To Be Included With Your Application.

For a list of required DLLs for the Barcode Control, refer to Files To Be Included With Your Application.


Working With Barcodes

LEADTOOLS supports the reading and writing of three major types of barcodes using the Axtel© engine. These types are:

 Linear barcodes (1D)

 PDF417 (2D)

 Data Matrix (2D)

For each major type of barcode, one or more subtypes are supported for both reading and writing. These subtypes are:

Linear Barcodes

 EAN 13

 EAN 8

 UPC A

 Code 3 of 9

 Code 128

 Interleaved 2 of 5

 CODABAR

 UCCEAN 128

PDF Barcodes

 PDF417

Data Matrix Barcodes

 BARCODE_DM_DEF

 BARCODE_DM_10x10

 BARCODE_DM_12x12

 BARCODE_DM_14x14

 BARCODE_DM_16x16

 BARCODE_DM_18x18

 BARCODE_DM_20x20

 BARCODE_DM_22x22

 BARCODE_DM_24x24

 BARCODE_DM_26x26

 BARCODE_DM_32x32

 BARCODE_DM_36x36

 BARCODE_DM_40x40

 BARCODE_DM_44x44

 BARCODE_DM_48x48

 BARCODE_DM_52x52

 BARCODE_DM_64x64

 BARCODE_DM_72x72

 BARCODE_DM_80x80

 BARCODE_DM_88x88

 BARCODE_DM_96x96

 BARCODE_DM_104x104

 BARCODE_DM_120x120

 BARCODE_DM_132x132

 BARCODE_DM_144x144

 BARCODE_DM_8x18

 BARCODE_DM_8x32

 BARCODE_DM_12x26

 BARCODE_DM_12x36

 BARCODE_DM_16x36

 BARCODE_DM_16x48

 BARCODE_DM_WRITE_RECTANGLE

LEADTOOLS supports the reading and writing of the above barcode types for all bitmaps currently supported by LEADTOOLS. For a full list of supported file formats, refer to Summary of All Supported Image File Formats.

The Read method reads barcodes from a bitmap in the Bitmap property, and stores the barcode information in the BarCodeData property. Once the barcodes are read, the TotalCount property is updated with the total number of barcodes read in by the Read method.

When reading linear barcodes, the ReadFlags property determines how the bitmap will be searched and whether or not barcodes with start and end markers will be recognized. In addition, the Linear property contains further information about reading linear barcodes and the PDFRead property contains information about reading PDF barcodes.

The EnableUseRegion property determines what area of a bitmap is searched for barcodes. If this property is true and the bitmap has a region, then the region will be searched for barcodes. If this property is true and the bitmap does not have a region, the entire bitmap will be searched for barcodes. If this property is false, then the Read method uses the location and size parameters to determine the area to search for barcodes. The units of measure for the location and size parameters is set using the Units property.

You can read/write barcodes by specifying a color for bars and spaces. Also, you can write transparent barcodes, but the transparent feature is not recommended.

The Write method writes a barcode to a bitmap in the Bitmap property.

When writing linear barcodes, the Linear property contains information about writing linear barcodes.

The following properties contain information used when writing Data Matrix barcodes:

DataMatrixWrite property

WriteFlags property

The following properties contain information used when writing QR barcodes:

QRWrite property

The following properties contain information used when writing PDF barcodes:

PDFWrite property

WriteFlags property

WriteGroup property

The following properties are used with the Write method, and to calculate the barcode size before writing the barcode over the bitmap.

EnableGetSizeMethod property

StartX property

StartY property

SizeX property

SizeY property

If a bitmap contains a region, the barcode will be written to that region. If the bitmap does not contain a region, then the location and size parameters passed to the Write method are used to determine the location for writing the barcode. The unit of measure for these location and size parameters is set using the Units property.

LEADTOOLS also provides methods for finding duplicate barcodes in the BarCodeData property. These include the following:

GetDuplicatedCount method

GetFirstDuplicated method

GetNextDuplicated method

IsDuplicated method

LEADTOOLS also provides the following support property and methods for this control:

EnableMethodErrors property

IsSupportLocked method

UnlockSupport method


Unlocking Barcode Support

Support for reading and writing Linear barcodes, reading Data Matrix, writing Data Matrix, reading PDF barcodes and writing PDF barcodes must be unlocked individually.

To unlock support for reading and writing Linear barcodes the UnlockSupport method must be called with the L_KEY_BARCODES_1D key found on the BarCode Certificate, which will be e-mailed to you. UnlockSupport (L_SUPPORT_BARCODES_1D, L_KEY_BARCODES_1D) tells the package to unlock Linear Barcode support and passes the key for verification.

To unlock support for reading Data Matrix barcodes the UnlockSupport method must be called with the L_KEY_BARCODES_DATAMATRIX_READ key found on the BarCode Certificate, which will be e-mailed to you. UnlockSupport(L_SUPPORT_BARCODES_DATAMATRIX_READ, L_KEY_BARCODES_DATAMATRIX_READ ) tells the package to unlock Data Matrix Barcode read support and passes the key for verification.

To unlock support for writing Data Matrix barcodes the UnlockSupport method must be called with the L_KEY_BARCODES_DATAMATRIX_WRITE key found on the BarCode Certificate, which will be e-mailed to you. UnlockSupport (L_SUPPORT_BARCODES_DATAMATRIX_WRITE, L_KEY_BARCODES_DATAMATRIX_WRITE) tells the package to unlock Data Matrix Barcode write support and passes the key for verification.

To unlock support for reading PDF barcodes the UnlockSupport method must be called with the L_KEY_BARCODES_PDF_READ found on the BarCode Certificate, which will be e-mailed to you. UnlockSupport (L_SUPPORT_BARCODES_PDF_READ, L_KEY_BARCODES_PDF_READ) tells the package to unlock PDF Barcode read support and passes the key for verification.

To unlock support for writing PDF barcodes the UnlockSupport method must be called with the L_KEY_BARCODES_PDF_WRITE found on the BarCode Certificate, which will be e-mailed to you. UnlockSupport (L_SUPPORT_BARCODES_PDF_WRITE, L_KEY_BARCODES_PDF_WRITE) tells the package to unlock PDF Barcode write support and passes the key for verification.


Unlocking Special LEAD Features

LEAD offers a variety of features, such as Document support, Medical support, Vector support, etc., which are only available in certain toolkits and are locked. To use these features you must:

 purchase a toolkit that supports the desired feature(s).

 print the applicable runtime agreement from the help file. For information on the runtime agreements, go to Topic Selection and click on the LEAD Licensing button.

 complete the Transmittal document and fax it and the runtime agreement to LEAD's Licensing Department at 704 – 372 – 3789. (To get a copy of the Transmittal document, you must contact LEAD.)

 if prepaid licenses are desired, include the order form with payment information. You can fax this along with the Transmittal form and the runtime agreement. (To get a copy of the order form, you must contact LEAD.)

 once we have received the signed agreement, we will send instructions for eliminating the license dialogs and the key(s) necessary for unlocking the appropriate features.

 when you have received the instructions and the key(s) call the UnlockSupport method with the appropriate key.

For example, if you have purchased the LEADTOOLS Document Imaging toolkit:

 print the Document Imaging Agreement (or the Document Imaging with OCR Agreement if you have also purchased the LEADTOOLS OCR Module).

 complete the Transmittal document and fax it and the Document Imaging Agreement (or the Document Imaging with OCR Agreement) to LEAD's Licensing Department.

 if you want prepaid licenses, print a copy of the order form, fill it out and send the order form and payment information to LEAD.

 once we have received the signed Document Imaging Agreement (or Document Imaging with OCR Agreement), we will send the instructions for eliminating the license dialogs and any necessary keys.

 when you receive the instructions and the key(s), call UnlockSupport (L_SUPPORT_DOCUMENT, "Document Key") to unlock the Document features. Please note that "Document Key" represents the actual key you will receive from LEAD. Also note that if you also purchased the LEADTOOLS OCR Module, the OCR features will have to be unlocked separately, using the appropriate key.

For information on products and the features available in each product, or for information on licensing, refer to Topic Selection.

To determine if a certain feature is locked, call the IsSupportLocked method.


BarCodeData property (LEADBarCode Control)

Visual Basic example	Visual C++ example
Syntax	IBARCODEDATA BarCodeData (short iIndex);
Overview	Refer to Working With Barcode
Remarks

Contains an array of barcode information, read in by the Read method.

Note:	The BARCODE_1D_UCCEAN_128 type is designed for reading UCCEAN 128 barcode only, and it is not designed for writing this barcode type.
The BarCodeData property has the following Read-Only properties:

Property	Type	Description
Data	BSTR	Character string containing the bar code data.
Left	long	The X coordinate of the bar code location. The unit of measure is determined by the Units property.
Top	long	The Y coordinate of the bar code location. The unit of measure is determined by the Units property.
Width	long	The width of the bar code. The unit of measure is determined by the Units property.
Height	long	The height of the bar code. The unit of measure is determined by the Units property.
Units	short	The unit of measure for the bar code Left, Top, Width and Height properties. Possible values are:
		Value	Meaning
		BARCODE_SCANLINES_PER_PIXELS	The location and size of the bar code are measured in pixels.
		BARCODE_INCHES	The location and size of the bar code are measured in inches.
		BARCODE_MILLIMETERS	The location and size of the barcode are measured in millimeters.
Type	Long	Barcode type.  Possible values are:
		Value	Meaning
		Linear (1D) barcode symbols:
		BARCODE_1D_EAN_13	EAN 13 type.
		BARCODE_1D_CODE_93	Code 93 type.
		BARCODE_1D_EAN_8	EAN 8 type.
		BARCODE_1D_UPC_A	UPC version A type.
		BARCODE_1D_UPC_E	UPC version E type.
		BARCODE_1D_CODE_3_OF_9	Code 3 of 9 (Code 39) type.
		BARCODE_1D_CODE_128	Code 128 type.
		BARCODE_1D_CODE_I2_OF_5	Interleaved 2 of 5 type.
		BARCODE_1D_CODA_BAR	CODABAR type.
		BARCODE_1D_UCCEAN_128	UCCEAND 128 type (for read only)
		PDF417 barcode symbol:
		BARCODE_PDF417	PDF417 type.
		Data Matrix barcode symbol:
		BARCODE_DM_10x10	[0x00000102] Data Matrix Type 10x10
		BARCODE_DM_12x12	[0x00000103] Data Matrix Type 12x12
		BARCODE_DM_14x14	[0x00000104] Data Matrix Type 14x14
		BARCODE_DM_16x16	[0x00000105] Data Matrix Type 16x16
		BARCODE_DM_18x18	[0x00000106] Data Matrix Type 18x18
		BARCODE_DM_20x20	[0x00000107] Data Matrix Type 20x20
		BARCODE_DM_22x22	[0x00000108] Data Matrix Type 22x22
		BARCODE_DM_24x24	[0x00000109] Data Matrix Type 24x24
		BARCODE_DM_26x26	[0x0000010A] Data Matrix Type 26x26
		BARCODE_DM_32x32	[0x0000010B] Data Matrix Type 32x32
		BARCODE_DM_36x36	[0x0000010C] Data Matrix Type 36x36
		BARCODE_DM_40x40	[0x0000010D] Data Matrix Type 40x40
		BARCODE_DM_44x44	[0x0000010E] Data Matrix Type 44x44
		BARCODE_DM_48x48	[0x0000010F] Data Matrix Type 48x48
		BARCODE_DM_52x52	[0x00000110] Data Matrix Type 52x52
		BARCODE_DM_64x64	[0x00000111] Data Matrix Type 64x64
		BARCODE_DM_72x72	[0x00000112] Data Matrix Type 72x72
		BARCODE_DM_80x80	[0x00000113] Data Matrix Type 80x80
		BARCODE_DM_88x88	[0x00000114] Data Matrix Type 88x88
		BARCODE_DM_96x96	[0x00000115] Data Matrix Type 96x96
		BARCODE_DM_104x104	[0x00000116] Data Matrix Type 104x104
		BARCODE_DM_120x120	[0x00000117] Data Matrix Type 120x120
		BARCODE_DM_132x132	[0x00000118] Data Matrix Type 132x132
		BARCODE_DM_144x144	[0x00000119] Data Matrix Type 144x144
		BARCODE_DM_8x18	[0x0000011A] Data Matrix Type 8x18
		BARCODE_DM_8x32	[0x0000011B] Data Matrix Type 8x32
		BARCODE_DM_12x26	[0x0000011C] Data Matrix Type 12x26
		BARCODE_DM_12x36	[0x0000011D] Data Matrix Type 12x36
		BARCODE_DM_16x36	[0x0000011E] Data Matrix Type 16x36
		BARCODE_DM_16x48	[0x0000011F] Data Matrix Type 16x48
		QR barcode symbols:
		BARCODE_QR_DEF	[0x00000300] Default QR Code size.
		BARCODE_QR_M2_1	[0x00000301] QR Code Model 2, Version 1
		BARCODE_QR_M2_2	[0x00000302] QR Code Model 2, Version 2
		BARCODE_QR_M2_3	[0x00000303] QR Code Model 2, Version 3
		BARCODE_QR_M2_4	[0x00000304] QR Code Model 2, Version 4
		BARCODE_QR_M2_5	[0x00000305] QR Code Model 2, Version 5
		BARCODE_QR_M2_6	[0x00000306] QR Code Model 2, Version 6
		BARCODE_QR_M2_7	[0x00000307] QR Code Model 2, Version 7
		BARCODE_QR_M2_8	[0x00000308] QR Code Model 2, Version 8
		BARCODE_QR_M2_9	[0x00000309] QR Code Model 2, Version 9
		BARCODE_QR_M2_10	[0x0000030A] QR Code Model 2, Version 10
		BARCODE_QR_M2_11	[0x0000030B] QR Code Model 2, Version 11
		BARCODE_QR_M2_12	[0x0000030C] QR Code Model 2, Version 12
		BARCODE_QR_M2_13	[0x0000030D] QR Code Model 2, Version 13
		BARCODE_QR_M2_14	[0x0000030E] QR Code Model 2, Version 14
		BARCODE_QR_M2_15	[0x0000030F] QR Code Model 2, Version 15
		BARCODE_QR_M2_16	[0x00000310] QR Code Model 2, Version 16
		BARCODE_QR_M2_17	[0x00000311] QR Code Model 2, Version 17
		BARCODE_QR_M2_18	[0x00000312] QR Code Model 2, Version 18
		BARCODE_QR_M2_19	[0x00000313] QR Code Model 2, Version 19
		BARCODE_QR_M2_20	[0x00000314] QR Code Model 2, Version 20
		BARCODE_QR_M2_21	[0x00000315] QR Code Model 2, Version 21
		BARCODE_QR_M2_22	[0x00000316] QR Code Model 2, Version 22
		BARCODE_QR_M2_23	[0x00000317] QR Code Model 2, Version 23
		BARCODE_QR_M2_24	[0x00000318] QR Code Model 2, Version 24
		BARCODE_QR_M2_25	[0x00000319] QR Code Model 2, Version 25
		BARCODE_QR_M2_26	[0x0000031A] QR Code Model 2, Version 26
		BARCODE_QR_M2_27	[0x0000031B] QR Code Model 2, Version 27
		BARCODE_QR_M2_28	[0x0000031C] QR Code Model 2, Version 28
		BARCODE_QR_M2_29	[0x0000031D] QR Code Model 2, Version 29
		BARCODE_QR_M2_30	[0x0000031E] QR Code Model 2, Version 30
		BARCODE_QR_M2_31	[0x0000031F] QR Code Model 2, Version 31
		BARCODE_QR_M2_32	[0x00000320] QR Code Model 2, Version 32
		BARCODE_QR_M2_33	[0x00000321] QR Code Model 2, Version 33
		BARCODE_QR_M2_34	[0x00000322] QR Code Model 2, Version 34
		BARCODE_QR_M2_35	[0x00000323] QR Code Model 2, Version 35
		BARCODE_QR_M2_36	[0x00000324] QR Code Model 2, Version 36
		BARCODE_QR_M2_37	[0x00000325] QR Code Model 2, Version 37
		BARCODE_QR_M2_38	[0x00000326] QR Code Model 2, Version 38
		BARCODE_QR_M2_39	[0x00000327] QR Code Model 2, Version 39
		BARCODE_QR_M2_40	[0x00000328] QR Code Model 2, Version 40
		BARCODE_QR_M1_1	[0x00000329] QR Code Model 1, Version 1
		BARCODE_QR_M1_2	[0x0000032A] QR Code Model 1, Version 2
		BARCODE_QR_M1_3	[0x0000032B] QR Code Model 1, Version 3
		BARCODE_QR_M1_4	[0x0000032C] QR Code Model 1, Version 4
		BARCODE_QR_M1_5	[0x0000032D] QR Code Model 1, Version 5
		BARCODE_QR_M1_6	[0x0000032E] QR Code Model 1, Version 6
		BARCODE_QR_M1_7	[0x0000032F] QR Code Model 1, Version 7
		BARCODE_QR_M1_8	[0x00000330] QR Code Model 1, Version 8
		BARCODE_QR_M1_9	[0x00000331] QR Code Model 1, Version 9
		BARCODE_QR_M1_10	[0x00000332] QR Code Model 1, Version 10
		BARCODE_QR_M1_11	[0x00000333] QR Code Model 1, Version 11
		BARCODE_QR_M1_12	[0x00000334] QR Code Model 1, Version 12
		BARCODE_QR_M1_13	[0x00000335] QR Code Model 1, Version 13
		BARCODE_QR_M1_14	[0x00000336] QR Code Model 1, Version 14
		BARCODE_QR_M1_DEF	[0x00000337] Default Model 1 QR Code size.
Group	short	The barcode symbol group. This member will be valid for Code One symbols, and for reading PDF417 symbols.
See Also

Elements:	Read method, TotalCount property


iIndex Parameter For BarCodeData
iIndex

Index into the array of barcodes. This is a zero-based index.


BarColor property (LEADBarCode Control)

Visual Basic example	Visual C++ example
Syntax	OLE_COLOR BarColor
Overview	Refer to Working With Barcode
Remarks

(Persistent property, available at design time) Gets/Sets the bars colors to search/write barcodes.

This property is used with Read, and Write methods for all barcode types.

The Read and Write methods will ignore this property value when the bitmap is 1BPP. For 16 or 32 BPP bitmaps, this is the actual value of the pixel as found in the image and not in COLORRF.

See Also

Elements:	EnableUseColors property, EnableTransparentproperty, SpaceColor property


Bitmap property (LEADBarCode Control)

Visual Basic example	Visual C++ example
Syntax	long Bitmap
Overview	Refer to Working With Barcode
Remarks

This is the handle to a LEAD bitmap.

You must set the bitmap before calling the Read method or the Write method.

This property is updated when the Write method is used to write a barcode over the bitmap. Before calling the Write method, the LEADBarCode Bitmap property contains the bitmap. When assigning from the Main Bitmap property to this property, a reference to the source bitmap is created.  A copy is NOT made.  To remove the reference, assign a value of 0.

See Also

Elements:	Read method, Write method


EnableGetSizeMethod property (LEADBarCode Control)

Visual Basic example	Visual C++ example
Syntax	VARIANT_BOOL EnableGetSizeMethod
Overview	Refer to Working With Barcode
Remarks

(Persistent property, available at design time) Enable calculating barcode size before writing it. Possible values are:

Value	Meaning
TRUE	Enable calculating barcode size.
FALSE	Disable calculating barcode size.

When this property value is TRUE, then the Write method will calculate the barcode size for the barcode to be written, and will update the values for the StartX, StartY, SizeX and SizeY properties.

When this property value is FALSE, then the Write method will print the barcode over the bitmap set in the Bitmap property.

See Also

Elements:	Write method, Linear property, DataMatrixWrite property, PDFWrite property, StartX property, StartY property, SizeX property, SizeY property


EnableMethodErrors property (LEADBarCode Control)

Visual Basic example	Visual C++ example
Syntax	BOOL EnableMethodErrors
Overview	Refer to Working With Barcode
Remarks

(Persistent property, available at design time) Specifies whether LEADTOOLS generates system error events (in addition to error return codes).

Setting	Description
TRUE	Generate system error events.
FALSE	Do not generate system error events.
See Also

Elements:	Read method, Write method, IsDuplicated method, GetNextDuplicated method, UnlockSupport method, IsSupportLocked method


EnableTransparent property (LEADBarCode Control)

Visual Basic example	Visual C++ example
Syntax	VARIANT_BOOL EnableTransparent
Overview	Refer to Working With Barcode
Remarks

(Persistent property, available at design time) Enable writing transparent barcode. Possible values are:

Value	Meaning
TRUE	Enable writing barcode with transparent background.
FALSE	Disable writing barcode with transparent background.
The property is used with all barcode types.

This property is not recommended to use.

See Also

Elements:	EnableUseColors property, BarColor property, SpaceColor property


EnableUseColors property (LEADBarCode Control)

Visual Basic example	Visual C++ example
Syntax	VARIANT_BOOL EnableUseColors
Overview	Refer to Working With Barcode
Remarks

(Persistent property, available at design time) Enable reading/writing colored barcodes. Possible values are:

Value	Meaning
TRUE	Enable reading/writing color barcode.
FALSE	Disable reading/writing color barcode.
When this property value is TRUE, then the Read or Write methods will use the BarColor and SpaceColor properties, otherwise, the Read/Write methods will ignore color values for BarColor and SpaceColor properties and use the default colors of black for bars and white for spaces.

The colors are used as the exact bar and space colors for searching/writing for the barcode.

Using colors does not apply for 1 bit per pixel images.

The property is used with all barcode types.

See Also

Elements:	EnableTransparent property, BarColor property, SpaceColor property


EnableUseRegion property (LEADBarCode Control)

Visual Basic example	Visual C++ example
Syntax	BOOL EnableUseRegion
Overview	Refer to Working With Barcode
Remarks

(Persistent property, available at design time) Determines whether to search for the barcodes using the region or not. This property is valid for the Read method. Possible values are:

Setting	Description
TRUE	If the bitmap has a region, the Read method will only search the region for barcodes. If the bitmap does not have a region, the Read method will search the entire bitmap for barcodes.
FALSE	The Read method will use the location and size parameters to determine what area of the bitmap to search for barcodes.
If the Bitmap has a region, the Write method will automatically write the barcode in the region.

See Also

Elements:	Read method, Write method, Bitmap property


GetDuplicatedCount method (LEADBarCode Control)

Visual Basic example	Visual C++ example
Syntax	short GetDuplicatedCount (short iIndex);
Overview	Refer to Working With Barcode
Remarks

Determines the total number of barcodes within the BarCodeData property that are duplicates of the barcode at index iIndex.

To get the total number of barcodes read in by the Read method, check the TotalCount property.

See Also

Elements:	BarCodeData property, TotalCount property, Read method, IsDuplicated method, GetFirstDuplicated method, GetNextDuplicated method


iIndex Parameter For GetDuplicatedCount
iIndex

Index of a barcode in the BarCodeData property. This is a zero-based index. iIndex must be >= 0 and less than the total number of barcodes read into the BarCodeData property by the Read method.


Return for GetDuplicatedCount
Return Value

Return	Meaning
0 <= Value < ERROR_FAILURE	The number of duplicated barcodes.
>= ERROR_FAILURE	An error occurred. Refer to Error Codes.


GetFirstDuplicated method (LEADBarCode Control)

Visual Basic example	Visual C++ example
Syntax	short GetFirstDuplicated (short iIndex);
Overview	Refer to Working With Barcode
Remarks

Returns the index of the first barcode in the BarCodeData property that is a duplicate of the barcode at position iIndex in the BarCodeData property.

For example, a call to the Read method reads ten barcodes into the BarCodeData property, an array. The IsDuplicated method is called for the barcode at index 3 of the BarCodeData property and TRUE is returned. Therefore one or more barcodes in the array are duplicates of the barcode at index 3. To get the total number of duplicated bar codes call GetDuplicatedCount method.

Calling the GetFirstDuplicated method with iIndex set to 3 returns the index of the first barcode in the array that is a duplicate of the barcode at index 3 in the array. Suppose this value is 0. The barcode present at index 0 in the array is the first duplicate of the barcode at index 3 in the array.

Calling the GetNextDuplicated method with iIndex set to 3 will return the index of the next barcode in the array that is a duplicate of the barcodes at index 0 and index 3. Suppose this value is 9. Therefore, the barcodes at index 0, index 3 and index 9 of the array are all duplicates.

See Also

Elements:	BarCodeData property, TotalCount property, Read method, IsDuplicated method, GetNextDuplicated method, GetDuplicatedCount method


iIndex Parameter For GetFirstDuplicated
iIndex

Index of a barcode. This method will return the index of the first barcode in the BarCodeData property that is a duplicate of the barcode at iIndex.


Return for GetFirstDuplicated
Return Value

Return	Meaning
0 <= Value < ERROR_FAILURE	The index of the first bar code in the array that is a duplicate of the barcode at iIndex.
>= ERROR_FAILURE	An error occurred. Refer to Error Codes.


GetNextDuplicated method (LEADBarCode Control)

Visual Basic example	Visual C++ example
Syntax	short GetNextDuplicated (short iIndex);
Overview	Refer to Working With Barcode
Remarks

Returns the index of the next barcode in the BarCodeData property that is a duplicate of the barcode specified by iIndex.

For example, a call to the Read method reads ten barcodes into the BarCodeData property, an array. The IsDuplicated method is called for the barcode at index 3 of the BarCodeData property and TRUE is returned. Therefore one or more barcodes in the array are duplicates of the barcode at index 3. To get the total number of duplicated bar codes call GetDuplicatedCount method.

Calling the GetFirstDuplicated method with iIndex set to 3 returns the index of the first barcode in the array that is a duplicate of the barcode at index 3 in the array. Suppose this value is 0. The barcode present at index 0 in the array is the first duplicate of the barcode at index 3 in the array.

Calling the GetNextDuplicated method with iIndex set to 3 will return the index of the next barcode in the array that is a duplicate of the barcodes at index 0 and index 3. Suppose this value is 9. Therefore, the barcodes at index 0, index 3 and index 9 of the array are all duplicates.

See Also

Elements:	BarCodeData property, TotalCount property, Read method, IsDuplicated method, GetFirstDuplicated method, GetDuplicatedCount method


iIndex Parameter For GetNextDuplicated
iIndex

Index of the current duplicated barcode. The value returned by this method will be greater than this value. This index is zero-based.


Return for GetNextDuplicated
Return Value

Return	Meaning
0 <= Value < ERROR_FAILURE	An index of next duplicated bar code.
>= ERROR_FAILURE	An error occurred. Refer to Error Codes.


IsDuplicated method (LEADBarCode Control)

Visual Basic example	Visual C++ example
Syntax	BOOL IsDuplicated (short iIndex);
Overview	Refer to Working With Barcode
Remarks

Returns a value that indicates whether the specified barcode is duplicated or not.

This method determines whether the barcode present at the specified index is duplicated in another location in the bitmap.

To read in barcodes present in a bitmap, use the Read method. Any index for which the BarCodeData property contains valid data can be passed to the IsDuplicated method.

If the specified barcode is duplicated, you can get the next duplicated barcode using the GetNextDuplicated method.

To get the total number of barcodes read into the BarCodeData property by the Read method, check the TotalCount property.

See Also

Elements:	BarCodeData property, TotalCount property, Read method, GetNextDuplicated method, GetDuplicatedCount method


iIndex Parameter For IsDuplicated
iIndex

Index of a barcode within the BarCodeData property. This is a zero-based index. iIndex must be >= 0 and less than the total number of barcodes read into the BarCodeData property by the Read method.


Return for IsDuplicated
Return Value

Return	Meaning
TRUE	The specified barcode is duplicated.
FALSE	The specified barcode is not duplicated.


IsSupportLocked method (LEADBarCode Control)

Visual Basic example	Visual C++ example
Syntax	BOOL IsSupportLocked (short iType);
Overview	Refer to Working With Barcode
Remarks

Indicates whether support is locked for an optional feature, such as LEADTOOLS Document/Medical capabilities.

For information about LEADTOOLS Document/Medical capabilities, contact LEAD.

To unlock a feature, use the UnlockSupport method.

See Also

Elements:	UnlockSupport method


iType Parameter For IsSupportLocked
iType

The optional feature to check.

Value	Meaning
L_SUPPORT_BARCODES_1D	Support for reading and writing Linear bar codes. This is available in the LEADTOOLS 1D Module.
L_SUPPORT_BARCODES_PDF_READ	Support for reading PDF bar codes. This is available in the LEADTOOLS 2D PDF Module (read).
L_SUPPORT_BARCODES_PDF_WRITE	Support for writing PDF bar codes. This is available in the LEADTOOLS 2D PDF Module (write).
L_SUPPORT_BARCODES_DATAMATRIX_READ	Support for reading Data Matrix bar codes. This is available in the LEADTOOLS 2D Data Matrix Module (read).
L_SUPPORT_BARCODES_DATAMATRIX_WRITE	Support for writing Data Matrix bar codes. This is available in the LEADTOOLS 2D Data Matrix Module (write).
L_SUPPORT_BITONAL	Support for Scale to Gray and Favor Black processing.
L_SUPPORT_CMW	Support for the CMW file format, which uses Wavelet CMP compression.
L_SUPPORT_DICOM	DICOM file format support, but not the DICOM Communication support.
L_SUPPORT_DOCUMENT	LEADTOOLS Document features . A LEADTOOLS Document license is required
L_SUPPORT_EXTGRAY	Support for 12 bit grayscale, 16-bit grayscale, 48-bit color and 64-bit color image creation and manipulation.
L_SUPPORT_ICR	Support for the ICR Module within the OCR engine. This supports the recognition of handwritten text. Available only in selected LEADTOOLS products. For a list of products, refer to Topic Selections.
L_SUPPORT_J2K	Unlocks support for JPEG2000 images. The support needs to be unlocked to read and write both types of JPEG 2000 images (JPEG 2000 stream and JP2 files).
L_SUPPORT_LTPRO	Support for advanced image processing functions only available in the Raster Pro and above toolkits.
L_SUPPORT_MEDICAL	Support for the capabilities unlocked by L_SUPPORT_DICOM and L_SUPPORT_EXTGRAY, plus all Medical features.
L_SUPPORT_MEDICAL_NET	Support for everything unlocked by L_SUPPORT_MEDICAL, plus support for the unsecure DICOM Network Communication for Message Exchange.
L_SUPPORT_OCR	Support for the OCR features. (Document/Medical).
L_SUPPORT_OCR_ASIAN	Support for the OCR engine to recognize Asian text. Available only in selected LEADTOOLS products. For a list of products, refer to Topic Selections.
L_SUPPORT_OCR_PDF_OUTPUT	Support for saving OCR results as a PDF file. This license is in addition to the cost of the OCR Plugin or Document Imaging Suite.
L_SUPPORT_OMR	Support for the OMR Module within the OCR engine. This supports the recognition of check boxes. Available only in selected LEADTOOLS products. For a list of products, refer to Topic Selections.
L_SUPPORT_PDF	Support for the PDF, PS and EPS file formats. Available only in the LEADTOOLS PDF Plug in. If this support is locked, the PDF, PS and EPS files will not be loaded or saved.
L_SUPPORT_PDF_SAVE	Support for saving raster images as a PDF file. Available only in selected LEADTOOLS products. For a list of products, refer to Topic Selections.
L_SUPPORT_VECTOR	Support for the Vector Features and Vector file formats. Available only in selected LEADTOOLS products. For a list of products, refer to Topic Selection.


Return for IsSupportLocked
Return Value

Return	Meaning
TRUE	The optional feature is locked.
FALSE	The optional feature is available in your toolkit.


Linear property (LEADBarCode Control)

Visual Basic example	Visual C++ example
Syntax	ILinearBar Linear
Overview	Refer to Working With Barcode
Remarks

Contains linear (1D) barcode information for reading or writing 1D bar codes.

The Linear property has the following properties:

Property	Type	Description
ReadDirection	short	Flag that indicates the orientation and direction for reading barcodes. This property is valid for the Read method. You can combine values when appropriate, by using a bitwise OR ( | ). Possible values are:
		Value	Meaning
		BARCODE_DIR_LEFT_TO_RIGHT	To read from left to right across the bitmap.
		BARCODE_DIR_RIGHT_TO_LEFT	To read from right to left across the bitmap.
		BARCODE_DIR_TOP_TO_BOTTOM	To read from top to bottom across the bitmap.
		BARCODE_DIR_BOTTOM_TO_TOP	To read from bottom to top across the bitmap.
		BARCODE_DIR_SKEW	To read in a skewed or diagonal direction.
		BARCODE_DIR_HORIZONTAL	To read horizontally (left to right and right to left).
		BARCODE_DIR_VERTICAL	To read vertically (top to bottom and bottom to top).
		BARCODE_DIR_DIAGONAL	To read in a diagonal or skewed direction.
WhiteLines	short	The number of lines of white space above and below the barcode symbol.
MaxLength	short	The maximum length of a barcode string This must be no greater than 64.
MinLength	short	The minimum length of a barcode string when searching for a non fixed length bar code. This property is valid for the Read method.
Granularity	short	Number of scanned lines per column to skip when reading a barcode. 9 is the default value. This means that each tenth line will be scanned when looking for a barcode. Scanning every line will slow the search process while skipping too many lines may skip over the barcode. This property is valid for the Read method.
EnableErrorCheck	BOOL	Enables or disables the use of an error check digit while reading or writing a bar code.
EnableWriteText	BOOL	Indicates whether the barcode string will be shown or not. This member is valid for the Write method. Possible values are:
		Value	Meaning
		TRUE	The barcode string will be shown.
		FALSE	The barcode string will not be shown.
See Also

Elements:	Read method, Write method


PDFRead property (LEADBarCode Control)

Visual Basic example	Visual C++ example
Syntax	IPDFRead PDFRead
Overview	Refer to Working With Barcode
Remarks

This property contains information for reading PDF symbols.

The PDFRead property has the following property:

Property	Type	Description
Direction	short	Flag that indicates the orientation and direction for reading barcodes. You can combine values when appropriate, by using a bitwise OR ( | ). Possible values are:
		Value	Meaning
		BARCODE_DIR_LEFT_TO_RIGHT	To read from left to right across the bitmap.
		BARCODE_DIR_RIGHT_TO_LEFT	To read from right to left across the bitmap.
		BARCODE_DIR_TOP_TO_BOTTOM	To read from top to bottom across the bitmap.
		BARCODE_DIR_BOTTOM_TO_TOP	To read from bottom to top across the bitmap.
		BARCODE_DIR_SKEW	To read in a skewed or diagonal direction.
		BARCODE_DIR_HORIZONTAL	To read horizontally (left to right and right to left).
		BARCODE_DIR_VERTICAL	To read vertically (top to bottom and bottom to top).
		BARCODE_DIR_DIAGONAL	To read in a diagonal or skewed direction.
See Also

Elements:	Read method, TotalCount property


PDFWrite property (LEADBarCode Control)

Visual Basic example	Visual C++ example
Syntax	IPDFWrite PDFWrite
Overview	Refer to Working With Barcode
Remarks

This property contains information for writing PDF symbols.

The PDFWrite property has the following properties:

Property	Type	Description
AspectWidth	long	The width of the aspect ratio of the symbol.
AspectHeight	long	The height of the aspect ratio of the symbol.
ECCLevel	long	Determines the ECC level for writing a PDF417 symbol. Possible values are:
		Value	Meaning
		BARCODE_PDF417_ECCLEVEL_0	Use ECC level 0. This uses 2 code words for error correction.
		BARCODE_PDF417_ECCLEVEL_1	Use ECC level 0. This uses 4 code words for error correction.
		BARCODE_PDF417_ECCLEVEL_2	Use ECC level 0. This uses 8 code words for error correction.
		BARCODE_PDF417_ECCLEVEL_3	Use ECC level 0. This uses 16 code words for error correction.
		BARCODE_PDF417_ECCLEVEL_4	Use ECC level 0. This uses 32 code words for error correction.
		BARCODE_PDF417_ECCLEVEL_5	Use ECC level 0. This uses 64 code words for error correction.
		BARCODE_PDF417_ECCLEVEL_6	Use ECC level 0. This uses 128 code words for error correction.
		BARCODE_PDF417_ECCLEVEL_7	Use ECC level 0. This uses 256 code words for error correction.
		BARCODE_PDF417_ECCLEVEL_8	Use ECC level 0. This uses 512 code words for error correction.
		BARCODE_PDF417_ECCUSE_PERCENT	Use the percentage to determine the ECC level.
ECCPercent	long	Determines the ECC character percentage. This will be used when the ECCLevel property value is BARCODE_PDF417_ECCUSE_PERCENT.
ModuleAspectRatio	long	Specifies the ratio of the width of the smallest element (Module property) to the height of a row of the PDF417 symbol.
Module	long	The size of the smallest element in width.
Rows	long	Number of rows for writing a PDF417 symbol. When the BARCODE_COLROWASLIMITS flag is set in the WriteFlags property, the Write method will not use the AspectWidth property.
Columns	long	Number of columns for writing a PDF417 symbol. When the BARCODE_COLROWASLIMITS flag is set in the WriteFlags property, the Write method will not use the AspectWidth property.
Justify	short	Determines the alignment (justification) of the resulting barcode symbols. You can combine values when appropriate, by using a bitwise OR ( | ). Possible values are:
		Value	Meaning
		BARCODE_JUSTIFY_RIGHT	Justifies the PDF417 symbol to the right side of the bitmap.
		BARCODE_JUSTIFY_H_CENTER	Justifies the PDF417 symbol in the horizontal center of the bitmap.
		BARCODE_JUSTIFY_BOTTOM	Justifies the PDF417 symbol to the bottom side of the bitmap.
		BARCODE_JUSTIFY_V_CENTER	Justifies the PDF417 symbol in the vertical center of the bitmap.
See Also

Elements:	Write method


QRWrite property (LEADBarCode Control)

Visual Basic example	Visual C++ example
Syntax	IQRWrite * QRWrite
Overview	Refer to Working With Barcode
Remarks

Gets or sets information for writing QR symbols.

The QRWrite property has the following properties:

Property	Type	Description
Flags	long	Flags that indicate how the QR barcode symbol is justified. You can combine values when appropriate, by using a bitwise OR ( | ).  Possible values are:
		Value	Meaning
		BARCODE_JUSTIFY_RIGHT	[0x1000] Justify the QR symbol to the right side of the bitmap.
		BARCODE_JUSTIFY_H_CENTER	[0x2000] Justify the QR symbol in the horizontal center of the bitmap.
		BARCODE_JUSTIFY_BOTTOM	[0x4000] Justify the QR symbol to the bottom side of the bitmap.
		BARCODE_JUSTIFY_V_CENTER	[0x8000] Justify the QR symbol in the vertical center of the bitmap.
GroupNumber	long	Specifies a group of QR Code symbols. The maximum number of symbols in a group is 16.
GroupTotal	long	Specifies the total number of QR Code symbols. The maximum number of symbols in a group is 16.
EccLevel	long	ECC level of QR Code symbol to write.  Possible values are:
		Value	Meaning
		BARCODE_QR_ECC_L	[0] QR Code ECC Level 'L', lowest capability.
		BARCODE_QR_ECC_M	[1] QR Code ECC Level 'M', standard capability.
		BARCODE_QR_ECC_Q	[2] QR Code ECC Level 'Q', high reliability.
		BARCODE_QR_ECC_H	[3] QR Code ECC Level 'H', maximum reliability.
Xmodule	long	Specifies the size of the written QR barcode in 0.001 inches. If the value is too small, a minimum of 5 pixels will be used.
See Also

Elements:	Write method


Read method (LEADBarCode Control)

Visual Basic example	Visual C++ example
Syntax	short Read (long ulSearchType, short iMultipleMax, long iSearchLeft, long iSearchTop, long iSearchWidth, long iSearchHeight);
Overview	Refer to Working With Barcode
Remarks

Searches for barcodes within the specified area.

Use this method to recognize barcode data.

The actual barcode information can be accessed through the BarCodeData property.

You must assign the Main Bitmap property to the LEADBarCode Control Bitmap property prior to calling the Read method.

To determine if a barcode element is duplicated or not, use the IsDuplicated method. If the barcode is duplicated, you can get the next duplicated barcode using the GetNextDuplicated method. To get the first duplicated barcode, use the GetFirstDuplicated method.

The LEADBarCode Control will free the allocated storage for the recognized barcodes when the program terminates.

The smallest Data Matrix symbol size is 40 pixels by 40 pixels. It can be read using BARCODE_DM_READ_SMALL since this enables the reading of Data Matrix symbols that are between 20 to 40 pixels in size.

See Also

Elements:	BarCodeData property, Linear property, PDFRead property, Bitmap property, EnableUseRegion property, EnableMethodErrors property, Units property, ReadFlags property, TotalCount property, IsDuplicated method, GetNextDuplicated method, GetFirstDuplicated method, GetDuplicatedCount method, UnlockSupport method, IsSupportLocked method


ulSearchType Parameter For Read
ulSearchType

Type of barcode for which to search. You can combine values when appropriate, by using a bitwise OR ( | ). Possible values are:

Value	Meaning
Linear Barcode:

BARCODE_1D_EAN_13	To read EAN 13 type.
BARCODE_1D_EAN_8	To read EAN 8 type.
BARCODE_1D_UPC_A	To read UPC version A type.
BARCODE_1D_UPC_E	To read UPC version E type.
BARCODE_1D_CODE_3_OF_9	To read Code 3 of 9 (Code 39) type.
BARCODE_1D_CODE_128	To read Code 128 type.
BARCODE_1D_CODE_I2_OF_5	To read Interleaved 2 of 5 type.
BARCODE_1D_CODA_BAR	To read CODABAR type.
BARCODE_1D_UCCEAN_128	To read UCCEAND 128 type
BARCODE_1D_CODE_93	To read Code 93 type.
BARCODE_1D_READ_ANYTYPE	To enable searching of all linear barcode types.
PDF Barcodes:

BARCODE_PDF417	To read PDF417 type.
Data Matrix Barcodes:

BARCODE_DM_READ_SQUARE	To read square Data Matrix symbols.
BARCODE_DM_READ_RECTANGLE	To read rectangular Data Matrix symbols.
BARCODE_DM_READ_SMALL	To read small Data Matrix symbols.
QR Barcodes:

BARCODE_QR_CODE	To read QR barcodes.


iMultipleMax Parameter For Read
iMultipleMax

Specifies the maximum number of barcodes to search. Pass 0 to read all barcodes in a specified search area.


iSearchLeft Parameter For Read
iSearchLeft

The X coordinate of the bar code search location. The unit of measure is determined by the Units property.


iSearchTop Parameter For Read
iSearchTop

The Y coordinate of the bar code search location. The unit of measure is determined by the Units property.


iSearchWidth Parameter For Read
iSearchWidth

The width of the search area for the bar code. The unit of measure is determined by the Units property.


iSearchHeight Parameter For Read
iSearchHeight

The height of the search area for the bar code. The unit of measure is determined by the Units property.


Return for Read
Return Value

Return	Meaning
0	The method was successful.
<> 0	An error occurred. Refer to Error Codes.


ReadFlags property (LEADBarCode Control)

Visual Basic example	Visual C++ example
Syntax	long ReadFlags
Overview	Refer to Working With Barcode
Remarks

This property holds the processing options for the Read method.

The following values are valid when searching for linear barcodes. You can combine values when appropriate, by using a bitwise OR ( | ). Pass 0 to get the default. Possible values are:

Setting	Description
BARCODE_MARKERS	Enables the reading of barcodes that have start and end markers.
BARCODE_BLOCK_SEARCH	Search for barcodes by moving up or down through the rectangle until the first character is read or there is no barcode found.
BARCODE_RETURNCHECK	When setting this bit, then the check character will be returned in all cases, whether BARCODE1D.bErrorCheck is enabled or not.
BARCODE_RETURNCORRUPT	Enables the engine to return the area that an un-readable PDF417 symbol was located.
BARCODE_RETURN_FOUR_POINTS	Enable return of four corners and not bounding rectangle.
BARCODE_PDF_READ_MODE_0	Basic Channel Mode :No transmission of symbology ID, No escape doubling, Macro PDF is illegal.ECI is illegal, Reserved code words are illegal.
BARCODE_PDF_READ_MODE_1	Extended Channel Mode.Transmit L1 symbology ID. Escape doubling. Macro PDF is transmitted. ECI is transmitted. Reserved code words are transmitted.
BARCODE_PDF_READ_MODE_2	Basic Channel Mode. Transmit L2 symbology ID. No escape doubling. Macro PDF is illegal. ECI is illegal. Reserved code words are illegal.
BARCODE_PDF_READ_MODE_3_BASIC	Basic Channel Mode. Transmit L0 symbology ID. No escape doubling. Macro PDF is illegal. ECI is illegal. Reserved code words are illegal.
BARCODE_PDF_READ_MODE_3_EXTENDED	Extended Channel Mode. Transmit L0 symbology ID. Escape doubling. Macro PDF is transmitted. ECI is transmitted in GLI format. Reserved code words transmitted.
BARCODE_PDF_READ_MACRO_OPTION_0	Enable the return of the optional macro ‘File Name’ field.
BARCODE_PDF_READ_MACRO_OPTION_1	Enable the return of the optional macro ‘Segment Count’ field.
BARCODE_PDF_READ_MACRO_OPTION_2	Enable the return of the optional macro ‘Time Stamp’ field.
BARCODE_PDF_READ_MACRO_OPTION_3	Enable the return of the optional macro ‘Sender’ field.
BARCODE_PDF_READ_MACRO_OPTION_4	Enable the return of the optional macro ‘Addressee’ field.
BARCODE_PDF_READ_MACRO_OPTION_5	Enable the return of the optional macro ‘File Size’ field.
BARCODE_PDF_READ_MACRO_OPTION_6	Enable the return of the optional macro ‘Checksum’ field.
BARCODE_PDF_READ_MACRO_OPTION_79AZ	Enable the return of all optional macro fields 7 to 9 and A to Z.
BARCODE_PDF_READ_RETURN_PARTIAL	Return PDF417 data even if ECC does not succeed.
BARCODE_DM_FORCE_INVERT	Force the Data Matrix read, to search for reversed color symbols even if non-inverted color symbols were found.
BARCODE_DM_FASTFIND_DISABLE	Disable fast find feature when reading Data Matrix symbols. Fast find is automatically disabled when reading small symbols.
Note:	The BARCODE_RETURNCHECK flag is used only with reading linear barcodes.
See Also

Elements:	Read method, Linear property


SpaceColor property (LEADBarCode Control)

Visual Basic example	Visual C++ example
Syntax	OLE_COLOR SpaceColor
Overview	Refer to Working With Barcode
Remarks

(Persistent property, available at design time) Gets or sets the space colors to use when searching for or writing barcodes.

This property is used with the Read, and Write methods for all barcode types.

The Read and Write methods will ignore this property value when the bitmap is 1BPP. For 16 or 32 BPP bitmaps, this is the actual value of the pixel as found in the image and not in COLORRF.

See Also

Elements:	EnableUseColors property, EnableTransparentproperty, BarColor property


SizeX property (LEADBarCode Control)

Visual Basic example	Visual C++ example
Syntax	long SizeX
Overview	Refer to Working With Barcode
Remarks

(Read only) Specifies the width of the window in which to write the barcode symbol. The unit of measure is determined by the Units property.

If this value is ‘0’, the edge of the image is the limit of the window. The engine will not write outside the described window.

Note:	This property is read only and its values will be updated using the Write method when the EnableGetSizeMethod property is TRUE.
See Also

Elements:	Write method, Linear property, DataMatrixWrite property, PDFWrite property, EnableGetSizeMethod property, StartX property, StartY property, SizeY property


SizeY property (LEADBarCode Control)

Visual Basic example	Visual C++ example
Syntax	long SizeY
Overview	Refer to Working With Barcode
Remarks

(Read only) Specifies the height of the window in which to write the barcode symbol. The unit of measure is determined by the Units property.

If this value is ‘0’, the bottom of the image is the limit of the window. The engine will not write outside the described window.

Note:	This property is read only and its values will be updated using the Write method when the EnableGetSizeMethod property is TRUE.
See Also

Elements:	Write method, Linear property, DataMatrixWrite property, PDFWrite property, EnableGetSizeMethod property, StartX property, StartY property, SizeX property


StartX property (LEADBarCode Control)

Visual Basic example	Visual C++ example
Syntax	long StartX
Overview	Refer to Working With Barcode
Remarks

(Read only) Specifies the x coordinate of the upper left corner of the window in which the barcode symbol will be written. The unit of measure is determined by the Units property.

Note:	This property is read only and its values will be updated using the Write method when the EnableGetSizeMethod property is TRUE.
See Also

Elements:	Write method, Linear property, DataMatrixWrite property, PDFWrite property, EnableGetSizeMethod property, StartY property, SizeX property, SizeY property


StartY property (LEADBarCode Control)

Visual Basic example	Visual C++ example
Syntax	long StartY
Overview	Refer to Working With Barcode
Remarks

(Read only) Specifies the y coordinate of the upper left corner of the window in which the barcode symbol will be written. The unit of measure is determined by the Units property.

Note:	This property is read only and its values will be updated using the Write method when the EnableGetSizeMethod property is TRUE.
See Also

Elements:	Write method, Linear property, DataMatrixWrite property, PDFWrite property, EnableGetSizeMethod property, StartX property, SizeX property, SizeY property


TotalCount property (LEADBarCode Control)

Visual Basic example	Visual C++ example
Syntax	short TotalCount
Overview	Refer to Working With Barcode
Remarks

(Read only) Gets the total number of recognized bar codes, read into the BarCodeData property by the Read method.

The actual barcode information can be accessed through the BarCodeData property.

See Also

Elements:	Read method, Linear property, PDFRead property, BarCodeData property


Units property (LEADBarCode Control)

Visual Basic example	Visual C++ example
Syntax	short Units
Overview	Refer to Working With Barcode
Remarks

(Persistent property, available at design time) Specifies the unit of measure for reading and writing barcodes.

The location (Left, Top) and size (Width, Height) parameters for the Read method or the Write method must be measured in one of the following:

Setting	Description
BARCODE_SCANLINES_PER_PIXELS	The location and sizes parameters for Read/Write methods are measured in pixels.
BARCODE_INCHES	The location and sizes parameters for Read/Write methods are measured in inches. You must multiply these parameters by 100. (I.e. to specify 1 inch set this to 100)
BARCODE_MILLIMETERS	The location and sizes parameters for Read/Write methods are measured in mm.
When using LEAD Controls for which the ScaleMode property has been set, the unit of measure set using the ScaleMode property must be converted to a unit of measure supported by the LEADBarCode control, before reading or writing barcodes.

The following example sets the unit of measure for the Main LEAD Control to Twips and sets the unit of measure for the LEADBarCode Control to pixels. It then searches for EAN 13 bar codes in the following area: (left. top) (150, 150) and (width, height) (150, 150), using the given conversion:

LEAD1.ScaleMode = 1  // Use Twips
LEADBarCode1.Units = BARCODE_SCANLINES_PER_PIXELS  // Use Pixels
LEADBarCode1.Bitmap = LEAD1.Bitmap

LEADBarCode1.Read (BARCODE_1D_EAN_13,
0,
150 / Screen.TwipsPerPixelX,
150 / Screen.TwipsPerPixelY,
150 / Screen.TwipsPerPixelX,
150 / Screen.TwipsPerPixelY)

See Also

Elements:	Read method, Write method


UnlockSupport method (LEADBarCode Control)

Visual Basic example	Visual C++ example
Syntax	void UnlockSupport (short iType, BSTR pszKey);
Overview	Refer to Working With Barcode
Remarks

Unlocks support for an optional feature, such as LEADTOOLS Document/Medical capabilities.

For information about LEADTOOLS Document/Medical capabilities, contact LEAD.

Note:	UnlockSupport can be replaced by entering the appropriate keys in LTOCX14.LIC. Edit the LTOCX14.LIC file and append at the end of a line, and on the same line, one or more pairs in the form |L_SUPPORT_xxx=key. The keys that can be specified are:
L_SUPPORT_BARCODES_1D
L_SUPPORT_BARCODES_PDF_READ
L_SUPPORT_BARCODES_PDF_WRITE
L_SUPPORT_BARCODES_DATAMATRIX_READ
L_SUPPORT_BARCODES_DATAMATRIX_WRITE
L_SUPPORT_BITONAL
L_SUPPORT_CMW
L_SUPPORT_DICOM
L_SUPPORT_DOCUMENT
L_SUPPORT_EXTGRAY
L_SUPPORT_J2K
L_SUPPORT_LTPRO
L_SUPPORT_MEDICAL
L_SUPPORT_MEDICAL_NET
L_SUPPORT_OCR
L_SUPPORT_OCR_ASIAN
L_SUPPORT_OCR_PDF_OUTPUT
L_SUPPORT_OMR
L_SUPPORT_PDF
L_SUPPORT_PDF_SAVE
L_SUPPORT_VECTOR

For example, if you wanted to unlock DOCUMENT and OCR support, you would include the following at the end of a line:

|L_SUPPORT_DOCUMENT=dockey|L_SUPPORT_OCR=ocrkey

See Also

Elements:	IsSupportLocked method


iType Parameter For UnlockSupport
iType

The optional feature to unlock.

Value	Meaning
L_SUPPORT_BARCODES_1D	Support for reading and writing Linear bar codes. This is available in the LEADTOOLS 1D Module.
L_SUPPORT_BARCODES_PDF_READ	Support for reading PDF bar codes. This is available in the LEADTOOLS 2D PDF Module (read).
L_SUPPORT_BARCODES_PDF_WRITE	Support for writing PDF bar codes. This is available in the LEADTOOLS 2D PDF Module (write).
L_SUPPORT_BARCODES_DATAMATRIX_READ	Support for reading Data Matrix bar codes. This is available in the LEADTOOLS 2D Data Matrix Module (read).
L_SUPPORT_BARCODES_DATAMATRIX_WRITE	Support for writing Data Matrix bar codes. This is available in the LEADTOOLS 2D Data Matrix Module (write).
L_SUPPORT_BITONAL	Support for Scale to Gray and Favor Black processing.
L_SUPPORT_CMW	Support for the CMW file format, which uses Wavelet CMP compression.
L_SUPPORT_DICOM	DICOM file format support, but not the DICOM Communication support.
L_SUPPORT_DOCUMENT	LEADTOOLS Document features . A LEADTOOLS Document license is required
L_SUPPORT_EXTGRAY	Support for 12 bit grayscale, 16-bit grayscale, 48-bit color and 64-bit color image creation and manipulation.
L_SUPPORT_ICR	Support for the ICR Module within the OCR engine. This supports the recognition of handwritten text. Available only in selected LEADTOOLS products. For a list of products, refer to Topic Selections.
L_SUPPORT_J2K	Unlocks support for JPEG2000 images. The support needs to be unlocked to read and write both types of JPEG 2000 images (JPEG 2000 stream and JP2 files).
L_SUPPORT_LTPRO	Support for advanced image processing functions only available in the Raster Pro and above toolkits.
L_SUPPORT_MEDICAL	Support for the capabilities unlocked by L_SUPPORT_DICOM and L_SUPPORT_EXTGRAY, plus all Medical features.
L_SUPPORT_MEDICAL_NET	Support for everything unlocked by L_SUPPORT_MEDICAL, plus support for the unsecure DICOM Network Communication for Message Exchange.
L_SUPPORT_OCR	Support for the OCR features. (Document/Medical).
L_SUPPORT_OCR_ASIAN	Support for the OCR engine to recognize Asian text. Available only in selected LEADTOOLS products. For a list of products, refer to Topic Selections.
L_SUPPORT_OCR_PDF_OUTPUT	Support for saving OCR results as a PDF file. This license is in addition to the cost of the OCR Plugin or Document Imaging Suite.
L_SUPPORT_OMR	Support for the OMR Module within the OCR engine. This supports the recognition of check boxes. Available only in selected LEADTOOLS products. For a list of products, refer to Topic Selections.
L_SUPPORT_PDF	Support for the PDF, PS and EPS file formats. Available only in the LEADTOOLS PDF Plug in. If this support is locked, the PDF, PS and EPS files will not be loaded or saved.
L_SUPPORT_PDF_SAVE	Support for saving raster images as a PDF file. Available only in selected LEADTOOLS products. For a list of products, refer to Topic Selections.
L_SUPPORT_VECTOR	Support for the Vector Features and Vector file formats. Available only in selected LEADTOOLS products. For a list of products, refer to Topic Selection.


pszKey Parameter For UnlockSupport
pszKey

The key to unlock the feature.


Return for UnlockSupport
Return Value

None


Write method (LEADBarCode Control)

Visual Basic example	Visual C++ example
Syntax	short Write (long ulBarType, BSTR pszBarData, long iBarLeft, long iBarTop, long iBarWidth, long iBarHeight);
Overview	Refer to Working With Barcode
Remarks

Writes a barcode over the bitmap.

You must assign the Main Bitmap property to the LEADBarCode Control Bitmap property prior to calling the Write method.

The Write method will write the barcode symbol over the bitmap using the location and size parameters for this method. However, if the bitmap has a region, this function will write the barcode in the region boundaries.

If the region is non-rectangular, the barcode will be written in the rectangle bounding the region and subsequently clipped to the given region. This might cause the resulting barcode to be unreadable.

The following table contains information for writing linear 1D barcodes:

	EAN 13	EAN 8	UPC A	UPC E	Code 3 of 9 (Code 39)	CODABAR	Code 128	Code Interleaved 2 of 5
Numerical digits	0-9	0-9	0-9	0-9	0-9	0-9	All ASCII characters	0-9
Alpha char.	N/A	N/A	N/A	N/A	A-Z and space bar	N/A		N/A
Special char.	N/A	N/A	N/A	N/A	- . $ % + /	- . $ % + /		N/A
Data Length	12	7	11	6 or 11	1-63	1-63	3-63	1-63
Min. width (pixels)	113	80	113	70	(I+4) * 15	N/A	(I + 5) * 11	(I*9)+ 9+ Q
Double width (pixels)	226	170	226	140	(I+4) * 30	N/A	(I + 5) * 22	((I*9)+ 9+ Q) * 2
Triple width (pixels)	339	255	339	210	(I+4) * 45	N/A	(I + 5) * 33	((I*9)+ 9+ Q) * 3
Quad width (pixels)	452	340	452	280	(I+4) * 60	N/A	(I + 5) * 44	((I*9)+ 9+ Q) * 5
Quintuple width (pixels)	N/A	N/A	N/A	N/A	N/A	N/A		N/A
FNC1 Char Set A	N/A	N/A	N/A	N/A	N/A	N/A	0x80	N/A
FNC2 Char Set A	N/A	N/A	N/A	N/A	N/A	N/A	0x81	N/A
FNC3 Char Set A	N/A	N/A	N/A	N/A	N/A	N/A	0x82	N/A
FNC4 Char Set A	N/A	N/A	N/A	N/A	N/A	N/A	0x83	N/A
FNC1 Char Set B	N/A	N/A	N/A	N/A	N/A	N/A	0x84	N/A
FNC2 Char Set B	N/A	N/A	N/A	N/A	N/A	N/A	0x85	N/A
FNC3 Char Set B	N/A	N/A	N/A	N/A	N/A	N/A	0x86	N/A
FNC4 Char Set B	N/A	N/A	N/A	N/A	N/A	N/A	0x87	N/A
FNC1 Char Set C	N/A	N/A	N/A	N/A	N/A	N/A	0x88	N/A
Start and Stop Chars	N/A	N/A	N/A	N/A	N/A	abcd	N/A	N/A
For Code 3 of 9 and Code 128:

I = # of characters in the string

Code Interleaved 2 of 5

I = # of digits and must be even.

Q = Quite Zone – 36 elements

See Also

Elements:	Linear property, PDFWrite property, PDFRead property, Bitmap property, EnableUseRegion property, EnableMethodErrors property, Units property, WriteFlags property, UnlockSupport method, IsSupportLocked method, EnableGetSizeMethod property, StartX property, StartY property, SizeX property, SizeY property


ulBarType Parameter For Write
ulBarType

Type of barcode to write. Possible values are:

Value	Meaning
Linear (1D) barcode symbols:

BARCODE_1D_EAN_13	EAN 13 type.
BARCODE_1D_EAN_8	EAN 8 type.
BARCODE_1D_UPC_A	UPC version A type.
BARCODE_1D_UPC_E	UPC version E type.
BARCODE_1D_CODE_3_OF_9	Code 3 of 9 (Code 39) type.
BARCODE_1D_CODE_128	Code 128 type.
BARCODE_1D_CODE_I2_OF_5	Interleaved 2 of 5 type.
BARCODE_1D_CODA_BAR	CODABAR type.
PDF417 barcode symbol:

BARCODE_PDF417	PDF417 type.
Data Matrix barcode symbol:

BARCODE_DM_10x10	[0x00000102] Data Matrix Type 10x10
BARCODE_DM_12x12	[0x00000103] Data Matrix Type 12x12
BARCODE_DM_14x14	[0x00000104] Data Matrix Type 14x14
BARCODE_DM_16x16	[0x00000105] Data Matrix Type 16x16
BARCODE_DM_18x18	[0x00000106] Data Matrix Type 18x18
BARCODE_DM_20x20	[0x00000107] Data Matrix Type 20x20
BARCODE_DM_22x22	[0x00000108] Data Matrix Type 22x22
BARCODE_DM_24x24	[0x00000109] Data Matrix Type 24x24
BARCODE_DM_26x26	[0x0000010A] Data Matrix Type 26x26
BARCODE_DM_32x32	[0x0000010B] Data Matrix Type 32x32
BARCODE_DM_36x36	[0x0000010C] Data Matrix Type 36x36
BARCODE_DM_40x40	[0x0000010D] Data Matrix Type 40x40
BARCODE_DM_44x44	[0x0000010E] Data Matrix Type 44x44
BARCODE_DM_48x48	[0x0000010F] Data Matrix Type 48x48
BARCODE_DM_52x52	[0x00000110] Data Matrix Type 52x52
BARCODE_DM_64x64	[0x00000111] Data Matrix Type 64x64
BARCODE_DM_72x72	[0x00000112] Data Matrix Type 72x72
BARCODE_DM_80x80	[0x00000113] Data Matrix Type 80x80
BARCODE_DM_88x88	[0x00000114] Data Matrix Type 88x88
BARCODE_DM_96x96	[0x00000115] Data Matrix Type 96x96
BARCODE_DM_104x104	[0x00000116] Data Matrix Type 104x104
BARCODE_DM_120x120	[0x00000117] Data Matrix Type 120x120
BARCODE_DM_132x132	[0x00000118] Data Matrix Type 132x132
BARCODE_DM_144x144	[0x00000119] Data Matrix Type 144x144
BARCODE_DM_8x18	[0x0000011A] Data Matrix Type 8x18
BARCODE_DM_8x32	[0x0000011B] Data Matrix Type 8x32
BARCODE_DM_12x26	[0x0000011C] Data Matrix Type 12x26
BARCODE_DM_12x36	[0x0000011D] Data Matrix Type 12x36
BARCODE_DM_16x36	[0x0000011E] Data Matrix Type 16x36
BARCODE_DM_16x48	[0x0000011F] Data Matrix Type 16x48


pszBarData Parameter For Write
pszBarData

Character string containing the bar code data to write.


iBarLeft Parameter For Write
iBarLeft

The X coordinate of the bar code location. The unit of measure is determined by the Units property.


iBarTop Parameter For Write
iBarTop

The Y coordinate of the bar code location. The unit of measure is determined by the Units property.


iBarWidth Parameter For Write
iBarWidth

The width of the bar code. The unit of measure is determined by the Units property.


iBarHeight Parameter For Write
iBarHeight

The height of the bar code. The unit of measure is determined by the Units property.


Return for Write
Return Value

Return	Meaning
0	The method was successful.
<> 0	An error occurred. Refer to Error Codes.


WriteFlags property (LEADBarCode Control)

Visual Basic example	Visual C++ example
Syntax	long WriteFlags
Overview	Refer to Working With Barcode
Remarks

Determines the behavior of the Write method.

The following values are used only when writing Data Matrix or PDF barcodes. You can combine values when appropriate, by using a bitwise OR ( | ). Pass 0 to use the default.

Setting	Description
BARCODE_TRUNCATE	Write Truncated PDF4167 barcodes.
BARCODE_MSGAPPEND	Write the barcode symbol in group mode. Used for PDF barcodes.
BARCODE_INITREADER	Write the reader initialization flags for Data Matrix and PDF barcodes.
BARCODE_DISABLE_COMPRESSOPN	Write Data Matrix barcodes without compression.
BARCODE_COLROWASLIMITS	Use column and row values as limits when a PDF barcode is written.
See Also

Elements:	Write method, Linear property, DataMatrixWrite property, PDFWrite property, EnableGetSizeMethod property, StartX property, StartY property, SizeX property, SizeY property


WriteGroup property (LEADBarCode Control)

Visual Basic example	Visual C++ example
Syntax	short WriteGroup
Overview	Refer to Working With Barcode
Remarks

This property specifies whether the barcode symbol is a member of a group of symbols. This property is used for writing Data Matrix and PDF417 barcodes.

If the barcode written by the Write method is not part of a group of barcode symbols, set this property to 0.

See Also

Elements:	Write method, Linear property, DataMatrixWrite property, PDFWrite property, EnableGetSizeMethod property, StartX property, StartY property, SizeX property, SizeY property


DataMatrixWrite property (LEADBarCode Control)

Visual Basic example	Visual C++ example
Syntax	IDATAMATRIXWrite DataMatrixWrite
Overview	Refer to Working With Barcode
Remarks

This property contains information for writing Data Matrix symbols.

The DataMatrixWrite property has the following properties:

Property	Type	Description
Flags	long	Flags used to configure the engine. You can combine values when appropriate, by using a bitwise OR ( | ). Possible values are Value  Meaning BARCODE_JUSTIFY_RIGHT Justifies the Data Matrix symbol to the right side of the bitmap. BARCODE_JUSTIFY_H_CENTER Justifies the Data Matrix symbol in the horizontal center of the bitmap. BARCODE_JUSTIFY_BOTTOM Justifies the Data Matrix symbol to the bottom side of the bitmap. BARCODE_JUSTIFY_V_CENTER Justifies the Data Matrix symbol in the vertical center of the bitmap.
GroupNumber	short	Specifies a group of Data Matrix symbols. The maximum number of symbols in a group is 16.
GroupTotal	short	Specifies the total number of Data Matrix symbols in the group specified by the GroupNumber property. The maximum number of symbols in a group is 16.
FileIDLow	short	File ID low byte. Specifies the low byte of the file ID number. The number must range from 1 to 254
FileIDHigh	short	File ID high byte. Specifies the high byte of the file ID number. The number must range from 1 to 254
XModule	short	The size of the written Data Matrix barcode, specified in 0.001 inch. If the value is too small, a minimum of 5 pixels will be used.
See Also

Elements:	Write method


Properties, Methods, and Events

Reading Barcodes

BarCodeData property

Bitmap property

EnableUseRegion property

Linear property

PDFRead property

Read method

ReadFlags property

TotalCount property

Units property

Writing Barcodes

Bitmap property

Linear property

PDFWrite property

Units property

Write method

WriteFlags property

WriteGroup property

EnableGetSizeMethod property

StartX property

StartY property

SizeX property

SizeY property

DataMatrixWrite property

QRWrite property

Finding Duplicate Barcodes

BarCodeData property

GetDuplicatedCount method

GetFirstDuplicated method

GetNextDuplicated method

IsDuplicated method

Reading/Writing colored barcodes

EnableUseColors

EnableTransparent

BarColor

SpaceColor

Support

EnableMethodErrors property

IsSupportLocked method

UnlockSupport method


Tutorial for Visual Basic Programmers

The following topics provide brief and simple examples to help you learn how to use the LEADTOOLS Barcode ActiveX.

Reading Barcodes

Writing Barcodes

Finding Duplicated Barcodes

Miscellaneous Examples


Reading Barcodes (Visual Basic)

Take the following steps to start a project and to add some code that searches for barcodes in a bitmap:

1.	Start Visual Basic.
2.	Add the LEAD Barcode Control to your project.
	For VB4: On the Tools pull-down menu, use the Custom Controls option, and select the LEAD Bar Code Control (14.5).
	For VB5: On the Project pull-down menu, use the Components option, and select the LEAD Bar Code Control (14.5).
3.	Add the LEAD Main Control to your project.
	For VB4: On the Tools pull-down menu, use the Custom Controls option, and select the LEAD Main Control (14.5).
	For VB5: On the Project pull-down menu, use the Components option, and select the LEAD Main Control (14.5).
4.	Select the LEAD Bar Code Control and add the control to your main form.
5.	Select the LEAD Main Control and add the control to your main form.  Size and position the control as you want it to appear at run time.
6.	Add two command buttons to your form and name them as follows:
	Name	Caption
	LoadLead	Load Image
	ReadBarBtn	Read Bar Code
7.	Add the following subroutine to your main form
Private Sub DisplayBarCodeInfo(iIndex As Integer)
   Dim strBarMsg As String

   With LEADBarCode1.BarCodeData(iIndex)
      strBarMsg = "No. " + CStr(iIndex) + Chr(13) + _
                "Type " + CStr(.Type) + Chr(13) + _
                "Units " + CStr(.Units) + Chr(13) + _
                "Data is " + .Data + Chr(13) + _
                "PosX " + CStr(.Left) + Chr(13) + _
                "PosY " + CStr(.Top) + Chr(13) + _
                "Width " + CStr(.Width) + Chr(13) + _
                "Height " + CStr(.Height) + Chr(13)
   End With

   MsgBox strBarMsg, vbInformation, "BarCode Info."
End Sub

8.	Code the LoadLead button's click procedure as follows:

Private Sub LoadLead_Click()
   LEAD1.Load "LEAD\images\barcode1.tif", 0, 0, 1
End Sub

9.	Code the ReadBarBtn button's click procedure as follows:

Private Sub ReadBarBtn_Click()
   Dim nRet As Integer
   Dim strBarMsg As String
   Dim I As Integer

   'Unlock linear barcodes support.
   'Note that this is a sample key, which will not work in your toolkit

   LEADBarCode1.UnlockSupport L_SUPPORT_BARCODES_1D, "TestKey"

   LEADBarCode1.Bitmap = LEAD1.Bitmap
   LEADBarCode1.EnableMethodErrors = False
   LEADBarCode1.EnableUseRegion = True

   With LEADBarCode1.Linear
      .EnableErrorCheck = True
      .Granularity = 9
      .ReadDirection = BARCODE_DIR_LEFT_TO_RIGHT
   End With

   ' The Read method will search for all linear barcodes in the bitmap
   nRet = LEADBarCode1.Read(BARCODE_1D_READ_ANYTYPE, 0, 0, 0, 0, 0)

   If nRet = 0 Then
      strBarMsg = "Total Bar Code Symbols Found =: " + CStr(LEADBarCode1.TotalCount)
      MsgBox strBarMsg, vbInformation, "Bar Code Count"

      For I = 0 To LEADBarCode1.TotalCount - 1
         DisplayBarCodeInfo I
      Next
   Else
      strBarMsg = "Error occurred in the Read method. Error No. = " + CStr(nRet)
      MsgBox strBarMsg, vbCritical, "Error!"
   End If
   LEADBarCode1.Bitmap = 0 ' release the reference to the bitmap
End Sub

10.	Run your program to test it.
11.	Save the project to use as a starting point for other tasks in this tutorial.


Writing Barcodes (Visual Basic)

Take the following steps to add some code that Writes a Bar Codes over the bitmap:

1.	Start with the project that you created in the Reading Barcodes Tutorial for Visual Basic.
2.	Add a command button to your form and name it as follows:
	Name	Caption
	WriteBarBtn	Write Bar Code
3.	Code the WriteBarBtn button's click procedure as follows:

Private Sub WriteBarBtn_Click()
   Dim nRet As Integer
   Dim strErrMsg As String

   'Unlock linear barcodes support.
   'Note that this is a sample key, which will not work in your toolkit

   LEADBarCode1.UnlockSupport L_SUPPORT_BARCODES_1D, "TestKey"
   LEADBarCode1.Bitmap = LEAD1.Bitmap

   LEADBarCode1.Units = BARCODE_INCHES
   With LEADBarCode1.Linear
      .EnableErrorCheck = True
      .EnableWriteText = True
   End With

   nRet = LEADBarCode1.Write(BARCODE_1D_EAN_13, "012345678901", 100, 100, 100, 50)
   If nRet = 0 Then
      LEAD1.ForceRepaint
   Else
      strErrMsg = "Error occurred in the Write method, Error No. = " + CStr(nRet)
      MsgBox strErrMsg, vbCritical, "Error!"
   End If

   LEADBarCode1.Bitmap = 0 ' release the reference to the bitmap
End Sub

4.	Run your program to test it.
5.	Save the project to use as a starting point for other tasks in this tutorial.


Finding Duplicated Barcodes (Visual Basic)

Take the following steps to add code that can find a duplicated barcodes in the bitmap.

1.	Start with the project that you created in the Reading Barcodes Tutorial for Visual Basic.
2.	Add a command button to your form and name it as follows:
	Name	Caption
	FindDupBar	Find Duplicate
3.	Code the FindDupBar button's click procedure as follows:

Private Sub FindDupBar_Click()
   Dim nDupIndex As Integer
   Dim strMsg As String

   If LEADBarCode1.IsDuplicated(4) Then
      nDupIndex = LEADBarCode1.GetFirstDuplicated(4)
      If nDupIndex >= ERROR_FAILURE Then
         strMsg = "Error occurred in the GetFirstDuplicated method. Error No. = " + CStr(nDupIndex)
         MsgBox strMsg, vbCritical, "Error!"
      Else
         ' Display the first duplicated barcode information.
         DisplayBarCodeInfo nDupIndex

         nDupIndex = LEADBarCode1.GetNextDuplicated(nDupIndex)
         If nDupIndex >= ERROR_FAILURE Then
            strMsg = "Error occurred in the GetNextDuplicated method. Error No. = " + CStr(nDupIndex)
            MsgBox strMsg, vbCritical, "Error!"
         Else
            ' Display the next duplicated barcode information.
            DisplayBarCodeInfo nDupIndex
         End If
      End If
   Else
      MsgBox "This Barcode is not duplicated ...", vbCritical, "Error!"
   End If
End Sub

4.	Run your program to test it.


Miscellaneous Examples (Visual Basic)

You can test any of the following examples by adding a command button and pasting the sample code in the Click procedure.

EnableGetSizeMethod example for Visual Basic

GetFirstDuplicated Example for Visual Basic

PDFRead example for Visual Basic

PDFWrite Example for Visual Basic

QRWrite example for Visual Basic

Read Example for Visual Basic

UnlockSupport example for Visual Basic

Write example for Visual Basic


EnableGetSizeMethod example for Visual Basic

Private Sub Command1_Click()
   Dim nRet As Integer
   Dim strMsg As String

   'Unlock Data Matrix write support.
   'Note that this is a sample key, which will not work in your toolkit

   LEADBarCode1.UnlockSupport L_SUPPORT_BARCODES_DATAMATRIX_WRITE, "TestKey"
   LEADBarCode1.Bitmap = LEAD1.Bitmap

   LEADBarCode1.Units = BARCODE_SCANLINES_PER_PIXELS
   LEADBarCode1.DataMatrixWrite.Flags = BARCODE_JUSTIFY_RIGHT
   LEADBarCode1.WriteFlags = BARCODE_INITREADER Or BARCODE_DISABLE_COMPRESSOPN

   LEADBarCode1.EnableGetSizeMethod = True
   nRet = LEADBarCode1.Write (BARCODE_DM_DEF, "Data Matrix Default Size", 100, 100, 0, 0)
   If nRet = 0 Then
      strMsg = "Barcode Size: " + Chr(13) + _
               "StartX = " + CStr(LEADBarCode1.StartX) + Chr(13) + _
               "StartY = " + CStr(LEADBarCode1.StartY) + Chr(13) + _
               "SizeX = " + CStr(LEADBarCode1.SizeX) + Chr(13) + _
               "SizeY = " + CStr(LEADBarCode1.SizeY)

      MsgBox strMsg, vbOKOnly, "Notice!"
   Else
      strMsg = "Error occurred in the Write method. Error No. = " + CStr(nRet)
      MsgBox strMsg, vbCritical, "Error!"
   End If

   LEADBarCode1.Bitmap = 0 ' release the reference to the bitmap
End Sub


GetFirstDuplicated Example for Visual Basic

Private Sub FindDupBtn_Click()
   Dim nDupIndex, nDupCount As Integer
   Dim strMsg As String

   If LEADBarCode1.IsDuplicated (0) Then
      nDupIndex = LEADBarCode1.GetFirstDuplicated(0)
      nDupCount = LEADBarCode1.GetDuplicatedCount(0)

      strMsg = "This Bar Code was found in " + CStr(nDupCount) + " different locations."
      MsgBox strMsg, vbInformation, "Notice!"

      If nDupIndex >= ERROR_FAILURE Then
         strMsg = "Error occurred in the GetFirstDuplicated method. Error No. = " + CStr(nDupIndex)
         MsgBox strMsg, vbCritical, "Error!"
      Else
         ' Display the first duplicate barcode information.
         With LEADBarCode1.BarCodeData(nDupIndex)
            strMsg = "No. " + CStr(nDupIndex) + Chr(13) + _
                      "Type " + CStr(.Type) + Chr(13) + _
                      "Units " + CStr(.Units) + Chr(13) + _
                      "Data is " + .Data + Chr(13) + _
                      "PosX " + CStr(.Left) + Chr(13) + _
                      "PosY " + CStr(.Top) + Chr(13) + _
                      "Width " + CStr(.Width) + Chr(13) + _
                      "Height " + CStr(.Height) + Chr(13)
            MsgBox strMsg, vbInformation, "BarCode Info."
         End With

         nDupIndex = LEADBarCode1.GetNextDuplicated(nDupIndex)
         If nDupIndex >= ERROR_FAILURE Then
            strMsg = "Error occurred in the GetNextDuplicated method. Error No. = " + CStr(nDupIndex)
            MsgBox strMsg, vbCritical, "Error!"
         Else
            ' Display the next duplicate barcode information.
            With LEADBarCode1.BarCodeData(nDupIndex)
               strMsg = "No. " + CStr(nDupIndex) + Chr(13) + _
                         "Type " + CStr(.Type) + Chr(13) + _
                         "Units " + CStr(.Units) + Chr(13) + _
                         "Data is " + .Data + Chr(13) + _
                         "PosX " + CStr(.Left) + Chr(13) + _
                         "PosY " + CStr(.Top) + Chr(13) + _
                         "Width " + CStr(.Width) + Chr(13) + _
                         "Height " + CStr(.Height) + Chr(13)
               MsgBox strMsg, vbInformation, "BarCode Info."
            End With
         End If
      End If
   Else
      MsgBox "This Barcode is not duplicated ...", vbCritical, "Error!"
   End If
End Sub


PDFRead example for Visual Basic

Private Sub ReadBtn_Click()
   Dim nRet As Integer
   Dim strBarMsg As String
   Dim I As Integer

   'Unlock PDF read support.
   'Note that this is a sample key, which will not work in your toolkit
   LEADBarCode1.UnlockSupport L_SUPPORT_BARCODES_PDF_READ, "TestKey"

   LEADBarCode1.Bitmap = LEAD1.Bitmap
   LEADBarCode1.EnableMethodErrors = False

   LEADBarCode1.PDFRead.Direction = BARCODE_DIR_LEFT_TO_RIGHT

   ' The Read method will search for the first 10 occurrences of the (PDF 417)
   'barcode type in the whole bitmap.
   nRet = LEADBarCode1.Read(BARCODE_PDF417, 10, 0, 0, 0, 0)

   If nRet = 0 Then
      strBarMsg = "Total Bar Code Symbols Found = " + CStr(LEADBarCode1.TotalCount)
      MsgBox strBarMsg, vbInformation, "Bar Code Count"

      For I = 0 To LEADBarCode1.TotalCount – 1
         With LEADBarCode1.BarCodeData(I)
            strBarMsg = "No. " + CStr(I) + Chr(13) + _
                      "Type " + CStr(.Type) + Chr(13) + _
                      "Units " + CStr(.Units) + Chr(13) + _
                      "Data is " + .Data + Chr(13) + _
                      "PosX " + CStr(.Left) + Chr(13) + _
                      "PosY " + CStr(.Top) + Chr(13) + _
                      "Width " + CStr(.Width) + Chr(13) + _
                      "Height " + CStr(.Height) + Chr(13)
            MsgBox strBarMsg, vbInformation, "BarCode Info."
         End With
      Next
   Else
      strBarMsg = "Error occurred in the Read method. Error No. = " + CStr(nRet)
      MsgBox strBarMsg, vbCritical, "Error!"
   End If
   LEADBarCode1.Bitmap = 0
End Sub


PDFWrite Example for Visual Basic

Private Sub WritePDFBtn_Click()
   Dim nRet As Integer
   Dim strErrMsg As String

   'Unlock PDF barcode write support.
   'Note that this is a sample key, which will not work in your toolkit

   LEADBarCode1.UnlockSupport L_SUPPORT_BARCODES_PDF_WRITE, "TestKey"
   LEADBarCode1.Bitmap = LEAD1.Bitmap

   LEADBarCode1.Units = BARCODE_SCANLINES_PER_PIXELS
   With LEADBarCode1.PDFWrite
      .ECCLevel = BARCODE_PDF417_ECCUSE_PERCENT
      .ECCPercent = 50
      .Module = 21
      .ModuleAspectRatio = 4
   End With

   LEADBarCode1.WriteFlags = BARCODE_INITREADER Or BARCODE_TRUNCATE

   nRet = LEADBarCode1.Write(BARCODE_PDF417, "PDF417 Symbol", 100, 100, 0, 0)
   If nRet = 0 Then
      LEAD1.ForceRepaint
   Else
      strErrMsg = "Error occurred in the Write method. Error No. = " + CStr(nRet)
      MsgBox strErrMsg, vbCritical, "Error!"
   End If

   LEADBarCode1.Bitmap = 0 ' release the reference to the bitmap
End Sub


Read Example for Visual Basic

Private Sub ReadBtn_Click()
   Dim nRet As Integer
   Dim strBarMsg As String
   Dim I As Integer

   'Unlock linear barcode support.
   'Note that this is a sample key, which will not work in your toolkit

   LEADBarCode1.UnlockSupport L_SUPPORT_BARCODES_1D, "TestKey"

   LEADBarCode1.Bitmap = LEAD1.Bitmap
   LEADBarCode1.EnableMethodErrors = False
   LEADBarCode1.EnableUseRegion = True
   LEADBarCode1.ReadFlags = BARCODE_MARKERS Or BARCODE_BLOCK_SEARCH

   LEADBarCode1.SpaceColor = RGB(0, 0, 255)
   LEADBarCode1.BarColor = RGB(255, 0, 0)
   LEADBarCode1.EnableUseColors = TRUE

   With LEADBarCode1.Linear
      .EnableErrorCheck = True
      .Granularity = 9
      .ReadDirection = BARCODE_DIR_LEFT_TO_RIGHT
   End With

   ' The Read method will search for the first 10 occurrences of the (EAN 13) barcode type
   ' in the bitmap region. If the bitmap does not have a region, the Read method will
   ' search for (EAN 13) barcodes in the whole bitmap.

   nRet = LEADBarCode1.Read(BARCODE_1D_EAN_13, 10, 0, 0, 0, 0)

   If nRet = 0 Then
      strBarMsg = "Total Bar Code Symbols Found = " + CStr(LEADBarCode1.TotalCount)
      MsgBox strBarMsg, vbInformation, "Bar Code Count"

      For I = 0 To LEADBarCode1.TotalCount - 1
         With LEADBarCode1.BarCodeData(I)
            strBarMsg = "No. " + CStr(I) + Chr(13) + _
                      "Type " + CStr(.Type) + Chr(13) + _
                      "Units " + CStr(.Units) + Chr(13) + _
                      "Data is " + .Data + Chr(13) + _
                      "PosX " + CStr(.Left) + Chr(13) + _
                      "PosY " + CStr(.Top) + Chr(13) + _
                      "Width " + CStr(.Width) + Chr(13) + _
                      "Height " + CStr(.Height) + Chr(13)
            MsgBox strBarMsg, vbInformation, "BarCode Info."
         End With
      Next
   Else
      strBarMsg = "Error occurred in the Read method. Error No. = " + CStr(nRet)
      MsgBox strBarMsg, vbCritical, "Error!"
   End If
   LEADBarCode1.Bitmap = 0
End Sub


UnlockSupport example for Visual Basic

Private Sub SupportLockBtn_Click()
   If LEADBarCode1.IsSupportLocked (L_SUPPORT_BARCODES_DATAMATRIX_READ) Then
      'Unlock Data Matrix Read support.
      'Note that this is a sample key, which will not work in your toolkit
      LEADBarCode1.UnlockSupport L_SUPPORT_BARCODES_DATAMATRIX_READ, "TestKey"
   End If
End Sub


Write example for Visual Basic

Private Sub WriteBtn_Click()
   Dim nRet As Integer
   Dim strErrMsg As String

   'Unlock Data Matrix write support.
   'Note that this is a sample key, which will not work in your toolkit

   LEADBarCode1.UnlockSupport L_SUPPORT_BARCODES_DATAMATRIX_WRITE, "TestKey"
   LEADBarCode1.Bitmap = LEAD1.Bitmap

   LEADBarCode1.Units = BARCODE_SCANLINES_PER_PIXELS
   LEADBarCode1.WriteFlags = BARCODE_INITREADER Or BARCODE_DISABLE_COMPRESSOPN
   LEADBarCode1.DataMatrixWrite.Flags = BARCODE_JUSTIFY_RIGHT

   LEADBarCode1.SpaceColor = RGB(0, 0, 255)
   LEADBarCode1.EnableTransparent = True
   LEADBarCode1.EnableUseColors = True

   nRet = LEADBarCode1.Write (BARCODE_DM_DEF, "Data Matrix Default Size", 100, 100, 0, 0)
   If nRet = 0 Then
      LEAD1.ForceRepaint
   Else
      strErrMsg = "Error occurred in the Write method. Error No. = " + CStr(nRet)
      MsgBox strErrMsg, vbCritical, "Error!"
   End If

   LEADBarCode1.Bitmap = 0 ' release the reference to the bitmap
End Sub


QRWrite example for Visual Basic

Private Sub WriteBtn_Click()
   Dim nRet As Integer
   Dim strErrMsg As String

   'Unlock Data Matrix write support.
   'Note that this is a sample key, which will not work in your toolkit

   LEADBarCode1.UnlockSupport L_SUPPORT_BARCODES_QR_WRITE, "TestKey"
   LEADBarCode1.Bitmap = LEAD1.Bitmap

   LEADBarCode1.Units = BARCODE_SCANLINES_PER_PIXELS
   LEADBarCode1.WriteFlags = BARCODE_INITREADER Or BARCODE_DISABLE_COMPRESSOPN
   LEADBarCode1.QRWrite.Flags = BARCODE_JUSTIFY_RIGHT

   LEADBarCode1.SpaceColor = RGB(0, 0, 255)
   LEADBarCode1.EnableTransparent = True
   LEADBarCode1.EnableUseColors = True

   nRet = LEADBarCode1.Write(BARCODE_QR_DEF, "QR Default Size", 100, 100, 0, 0)
   If nRet = 0 Then
      LEAD1.ForceRepaint
   Else
      strErrMsg = "Error occurred in the Write method. Error No. = " + CStr(nRet)
      MsgBox strErrMsg, vbCritical, "Error!"
   End If

   LEADBarCode1.Bitmap = 0 ' release the reference to the bitmap
End Sub


Copyright Notices

©Copyright LEAD Technologies, Inc. 1991-2005. ALL RIGHTS RESERVED

Portions of the PCDLIB32.DLL, PCDLIB.DLL, LFFPX7.DLL, LFKODAK.DLL, EKFPIXJPEG140.DLL, PDC_SDK.DLL, PROFIRE.DLL, DC120V154_32.DLL, LFDCR14N.DLL, DCSPROBACK.DLL, DCSPRO3SLR.DLL, LFDCS14N.DLL, and LFKDC14N.DLL files contain material that is ©Copyright Eastman Kodak Company, 1996-2001. This software is based in part on the work of the Independent JPEG Group.

Portions of the LFCRW14N.DLL, LTCMP14.DLL, CDSDK.reg, CDSDK.dll, CDRAPCLS.dll, czs_ui.dll, deimg.dll, deImg010.dll, deImg110.dll, deImg153.dll, deimg301.dll, deimg401.dll, deImg404.dll, deimg602.dll, Deimg603.dll, DeImgd60.dll, pscAdimg.dll, pscCllct.dll, pscCStUI.dll, pscDcd.dll, pscDevUI.dll, pscDvlp.dll, Pscl2STI.dll, pscll.dll, pscParse.dll, pscSetup.dll, psdkdll.dll, psdkReg.dll, psParse.dll. file contain material that is © Canon, Inc. 2002

Portions of the LFFPX7.DLL and LFKODAK.DLL files contain material that is ©Copyright Hewlett Packard, 1996.

Portions of the OCR/ICR/OMR Features and the help file for the OCR/ICR/OMR Features are ©Copyright Scansoft, Inc. 1995-2003. ALL RIGHTS RESERVED

Portions of the Barcode Modules contain material that is ©Copyright Axtel Inc., 1999.

Portions of the LEADTOOLS PDF Plug in and the LEADTOOLS Vector Imaging Pro are ©Copyright 1996, 2000 Artifex Software Inc. All rights reserved.

File filters for decoding MrSID ® and DjVu ® formats are provided under a license from Lizardtech, Inc.

The "FlashPix" format uses Microsoft's OLE structured storage.

Portions of the DICOM help files in Medical Imaging product line are reprinted with permission from the National Electrical Manufacturers Association ©Copyright 1998 by the National Electrical Manufacturers Association. All rights including translation into other languages, reserved under the Universal Copyright Convention, the Berne Convention or the Protection of Literacy and Artistic Works, and the International and Pan American Copyright Conventions.

Portions of LEADTOOLS Data Security Add On contain software developed by the OpenSSL Project for use in the OpenSSL Toolkit (http://www.openssl.org/), including cryptographic software written by Eric Young (eay@cryptsoft.com) and by Tim Hudson (tjh@cryptsoft.com). Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) All rights reserved. Copyright Tim Hudson 1995-1998 (tjh@cryptsoft.com) All rights reserved.

Portions of LEADTOOLS Data Security Add On contain software based on the MD5 Message Digest Algorithm developed by RSA Data Security, Inc.. Copyright (c) 1991-92 RSA Data Security, Inc. All Rights Reserved.

Portions hereof licensed under US patent 5,327,254 and foreign counterparts.

Portions of the LEADTOOLS ICC Profiles material is © Copyright 2004, International Color Consortium.

Trademarks

LEAD® and LEADTOOLS® are registered trademarks of LEAD Technologies, Inc.
Microsoft, Windows, Windows NT, Visual Basic, Visual FoxPro, and Microsoft Access are either trademarks or registered trademarks of the Microsoft Corporation.
OS/2® is a registered trademark of International Business Machines Corporation.

TextBridge®OCR is a registered trademark of Scansoft, Inc.

ISIS® is a registered trademark of Pixel Translations, Inc.

ScanAhead™ is a trademark of Pixel Translations, Inc.

FlashPix™ is a trademark of Eastman Kodak Company.

All other brand or product names used in this online help are trademarks of their respective holders.

Address and Contact Information

LEAD Technologies, Inc.
Suite 400
1201 Greenwood Cliff
Charlotte, NC 28204

(704) 332-5532
FAX: (704) 372-8161
E-mail: support@leadtools.com
Technical support: (704) 372-9681 or support@leadtools.com
Home page: http://www.leadtools.com


Topic Selection

LEAD Technologies, Inc. Suite 400 1201 Greenwood Cliff Charlotte, NC 28204 Sales@Leadtools.com www.leadtools.com	(704) 332-5532 FAX: (704) 372-8161 Tech Support: (704) 372-9681
LEADTOOLS is ideal for developers involved in still frame, multimedia, document, medical, and vector imaging projects, including Internet/Intranet applications.  Independent of the specific application requirement – scanning, file format support/conversion, compression, image processing, annotation, database support, multimedia, etc. – LEADTOOLS provides the most comprehensive, robust, flexible, and powerful imaging solution available.

	Click this button to start the LEADTOOLS Licensing help file.
	Click this button to start the LEADTOOLS Products help file.
	Click this button to start the LEADTOOLS Image Categories help file.


Barcode Modules

The following Barcode Modules are available from LEAD. Please note (*) that each module requires runtime-licensing.

LEADTOOLS 1D Symbols (read and write)   $1195*

LEADTOOLS 2D Code One (read)   $1595*

LEADTOOLS 2D Code One (write)   $1395*

LEADTOOLS 2D PDF417 (read)   $1595*

LEADTOOLS 2D PDF417 (write)   $1395*


Technical Support

As a registered user, free technical support is available. You must register your software to receive any technical support. Technical support is available 9 a.m. through 6 p.m. Eastern Standard Time. If you are calling by phone, please be at your computer. You can also contact us through the following methods:

Phone:	(704) 372-9681
E-mail:	support@leadtools.com
FAX:	(704) 372-8161
Online Support / FAQs	http://www.leadtools.com (click on Customers Only)
Home page:	http://www.leadtools.com
FTP:	ftp.leadtools.com
You can also contact LEAD by mail at:

LEAD Technologies, Inc.
Attn: Technical Support
Suite 400
1201 Greenwood Cliff
Charlotte, NC 28204

Before calling technical support, please look in the online documentation and the example programs for an answer to your question.


Version History

Current version:	14.5
Last update:	October 13, 2005

Changes from Version 14 to Version 14.5

Changes from Version 13 to Version 14

Changes from Version 12.1 to Version 13

Changes from Version 12 to Version 12.1

Changes from Version 11.5 to Version 12

Version 11.5


Changes from Version 14 to Version 14.5

Version 14.5 of the LEADTOOLS Barcode ActiveX has changed from Version 14 as follows:

 LEADTOOLS Barcode ActiveX now supports the QR type barcodes.

 New properties for writing barcodes:

QRWrite property


Changes from Version 13 to Version 14

Version 14 of the LEADTOOLS Barcode ActiveX has not changed from Version 13.


Changes from Version 12.1 to Version 13

Version 13 of the LEADTOOLS Barcode ActiveX has changed from Version 12.1 as follows:

 LEADTOOLS Barcode ActiveX now supports the DATA MATRIX type barcodes.

 LEADTOOLS Barcode ActiveX no longer supports the CODEONE (2D) type barcodes.

 LEADTOOLS Barcode ActiveX now supports UCCEAND 128 type linear barcodes, read only.

 New properties for writing barcodes:

DataMatrixWrite property

EnableGetSizeMethod property

StartX property

StartY property

SizeX property

SizeY property

 The following property has been removed from the LEADTOOLS Barcode ActiveX:

CodeOneWrite property


Changes from Version 12 to Version 12.1

Version 12.1 of the LEADTOOLS Barcode ActiveX has not changed from Version 12.


Changes from Version 11.5 to Version 12

Version 12 of LEADTOOLS Barcode ActiveX has changed from version 11.5 as follows:

 The latest revision of the barcode engine is now supported, including support for color barcodes.


Version 11.5

Version 11.5 is the first version of LEADTOOLS Barcode ActiveX

The rest of this topic lists the barcode properties, methods and events in version 11.5.

Barcode

BarCodeData property (LEADBarCode Control)

Bitmap property (LEADBarCode Control)

CodeOneWrite property (LEADBarCode Control)

EnableMethodErrors property (LEADBarCode Control)

EnableUseRegion property (LEADBarCode Control)

GetDuplicatedCount method (LEADBarCode Control)

GetFirstDuplicated method (LEADBarCode Control)

GetNextDuplicated method (LEADBarCode Control)

IsDuplicated method (LEADBarCode Control)

IsSupportLocked method (LEADBarCode Control)

Linear property (LEADBarCode Control)

PDFRead property (LEADBarCode Control)

PDFWrite property (LEADBarCode Control)

Read method (LEADBarCode Control)

ReadFlags property (LEADBarCode Control)

TotalCount property (LEADBarCode Control)

Units property (LEADBarCode Control)

UnlockSupport method (LEADBarCode Control)

Write method (LEADBarCode Control)

WriteFlags property (LEADBarCode Control)

WriteGroup property (LEADBarCode Control)


Tutorial for FoxPro Programmers

The following topics provide brief and simple examples to help you learn how to use the LEADTOOLS Barcode ActiveX.

Reading Barcodes

Writing Barcodes

Finding Duplicated Barcodes

Miscellaneous Examples


Reading Barcodes (Visual FoxPro 6.0)

Take the following steps to start a project and to add some code that searches for barcodes in a bitmap:

1.	Start Visual FoxPro.
2.	Add the LEAD Main Control and Barcode Control to your environment.
	On the Tools menu, select Options...
	In the Options window, click the Controls tab, display the ActiveX controls, mark the LEAD Main Control (14.5) and LEAD BarCode Control (14.5), click the Set As Default button, then click the OK button. This registers the controls and makes them available for all projects.
3.	On the File menu, select New... and create a new form.
4.	Select the LEAD Bar Code Control, add the control to your form and change its name to LEADBarCode1.
5.	Select the LEAD Main Control and add the control to your main form.  Size and position the control as you want it to appear at run time and change its name to LEAD1.
6.	Add two command buttons to your form and name them as follows:
	Name	Caption
	LoadLead	Load Image
	ReadBarBtn	Read Bar Code
7.	On the Form menu, select New Method. Name the new method DisplayBarCodeInfo and code its procedure as follows:
Parameter iIndex
With ThisForm.LEADBarCode1.BarCodeData(iIndex)
   strBarMsg = "No. " + Str(iIndex) + Chr(13) + ;
        "Type " + Str(.Type) + Chr(13) + ;
        "Units " + Str(.Units) + Chr(13) + ;
        "Data is " + .Data + Chr(13) + ;
        "PosX " + Str(.Left) + Chr(13) + ;
        "PosY " + Str(.Top) + Chr(13) + ;
        "Width " + Str(.Width) + Chr(13) + ;
        "Height " + Str(.Height) + Chr(13)
EndWith
MessageBox(strBarMsg)

8.	Code the LoadLead button's click procedure as follows:
ThisForm.LEAD1.Load("c:\temp\barcode1.tif", 0, 0, 1)

9.	Code the ReadBarBtn button's click procedure as follows:
#define L_SUPPORT_BARCODES_1D 9
#define BARCODE_DIR_LEFT_TO_RIGHT 1
#define BARCODE_1D_READ_ANYTYPE 4080
&& Unlock linear barcode support.
&& Note that this is a sample key, which will not work in your toolkit

ThisForm.LEADBarCode1.UnlockSupport(L_SUPPORT_BARCODES_1D, "TestKey")

ThisForm.LEADBarCode1.Bitmap = ThisForm.LEAD1.Bitmap
ThisForm.LEADBarCode1.EnableMethodErrors = .F.
ThisForm.LEADBarCode1.EnableUseRegion = .T.

ThisForm.LEADBarCode1.Linear.EnableErrorCheck = .T.
ThisForm.LEADBarCode1.Linear.Granularity = 9
ThisForm.LEADBarCode1.Linear.ReadDirection = BARCODE_DIR_LEFT_TO_RIGHT

&& The Read method will search for all linear barcodes in the bitmap
nRet = ThisForm.LEADBarCode1.Read(BARCODE_1D_READ_ANYTYPE, 0, 0, 0, 0, 0)

If nRet = 0 Then
   strBarMsg = "Total Bar Code Symbols Found =: " + Str(ThisForm.LEADBarCode1.TotalCount)
   MessageBox(strBarMsg, 64, "Bar Code Count")

   For I = 0 To ThisForm.LEADBarCode1.TotalCount - 1
      ThisForm.DisplayBarCodeInfo(I)
   Next
Else
   strBarMsg = "Error occurred in the Read method. Error No. = " + Str(nRet)
   MessageBox(strBarMsg, 16, "Error!")
EndIf
ThisForm.LEADBarCode1.Bitmap = 0 && release the reference to the bitmap

10.	Run your program to test it.
11.	Save the project to use as a starting point for other tasks in this tutorial.


Writing Barcodes (Visual FoxPro 6.0)

Take the following steps to add some code that Writes a Bar Codes over the bitmap:

1.	Start with the form that you created in the Reading Barcodes (Visual FoxPro 6.0).
2.	Add a command button to your form and name it as follows:
	Name	Caption
	WriteBarBtn	Write Bar Code
3.	Code the WriteBarBtn button's click procedure as follows:
#define L_SUPPORT_BARCODES_1D 9
#define BARCODE_INCHES 1
#define BARCODE_1D_EAN_13 0x00000001

&& Unlock linear barcode support.
&& Note that this is a sample key, which will not work in your toolkit

ThisForm.LEADBarCode1.UnlockSupport(L_SUPPORT_BARCODES_1D, "TestKey")
ThisForm.LEADBarCode1.Bitmap = ThisForm.LEAD1.Bitmap

ThisForm.LEADBarCode1.Units = BARCODE_INCHES
With ThisForm.LEADBarCode1.Linear
   .EnableErrorCheck = .T.
   .EnableWriteText = .T.
EndWith

nRet = ThisForm.LEADBarCode1.Write(BARCODE_1D_EAN_13, "012345678901", 1, 1, 2, 1)
If nRet = 0 Then
   ThisForm.LEAD1.ForceRepaint()
Else
   strErrMsg = "Error occurred in the Write method, Error No. = " + Str(nRet)
   MessageBox(strErrMsg, 16, "Error!")
EndIf

ThisForm.LEADBarCode1.Bitmap = 0 && release the reference to the bitmap

4.	Run your program to test it.
5.	Save the project to use as a starting point for other tasks in this tutorial.


Finding Duplicated Barcodes (Visual FoxPro 6.0)

Take the following steps to add code that can find a duplicated barcodes in the bitmap.

1.	Start with the form that you created in the Reading Barcodes (Visual FoxPro 6.0).
2.	Add a command button to your form and name it as follows:
	Name	Caption
	FindDupBar	Find Duplicate
3.	Code the FindDupBar button's click procedure as follows:
#define ERROR_FAILURE 20000
If ThisForm.LEADBarCode1.IsDuplicated(4) != 0 Then
   nDupIndex = ThisForm.LEADBarCode1.GetFirstDuplicated(4)
   If nDupIndex >= ERROR_FAILURE Then
      strMsg = "Error occurred in the GetFirstDuplicated method. Error No. = " + Str(nDupIndex)
      MessageBox(strMsg, 16, "Error!")
   Else
      && Display the first duplicated barcode information.
      ThisForm.DisplayBarCodeInfo(nDupIndex)
      nDupIndex = ThisForm.LEADBarCode1.GetNextDuplicated(nDupIndex)
      If nDupIndex >= ERROR_FAILURE Then
         strMsg = "Error occurred in the GetNextDuplicated method. Error No. = " + Str(nDupIndex)
         MessageBox(strMsg, 16, "Error!")
      Else
         && Display the next duplicated barcode information.
         ThisForm.DisplayBarCodeInfo(nDupIndex)
      EndIf
   EndIf
Else
   MessageBox("This barcode is not duplicated ...", 16, "Error!")
EndIf

4.	Run your program to test it.


Miscellaneous Examples (Visual FoxPro 6.0)

You can test any of the following examples by adding a command button and pasting the sample code in the Click procedure.

EnableGetSizeMethod example for Visual FoxPro 6.0

GetFirstDuplicated Example for Visual FoxPro 6.0

PDFRead example for Visual FoxPro 6.0

PDFWrite Example for Visual FoxPro 6.0

Read Example for Visual FoxPro 6.0

UnlockSupport example for Visual FoxPro 6.0

Write example for Visual FoxPro 6.0


EnableGetSizeMethod example for Visual FoxPro 6.0

#define L_SUPPORT_BARCODES_DATAMATRIX_WRITE 33
#define BARCODE_INCHES 1
#define BARCODE_JUSTIFY_RIGHT             0x1000
#define BARCODE_INITREADER                0x0040
#define BARCODE_DISABLE_COMPRESSOPN       0x0100
#define BARCODE_DM_DEF                    0x00000101

&& Unlock Data Matrix write support.
&& Note that this is a sample key, which will not work in your toolkit

ThisForm.LEADBarCode1.UnlockSupport(L_SUPPORT_BARCODES_DATAMATRIX_WRITE, "TestKey")
ThisForm.LEADBarCode1.Bitmap = ThisForm.LEAD1.Bitmap

ThisForm.LEADBarCode1.Units = BARCODE_INCHES
ThisForm.LEADBarCode1.DataMatrixWrite.Flags = BARCODE_JUSTIFY_RIGHT
ThisForm.LEADBarCode1.WriteFlags = BitOr(BARCODE_INITREADER, BARCODE_DISABLE_COMPRESSOPN)

ThisForm.LEADBarCode1.EnableGetSizeMethod = .T.
nRet = ThisForm.LEADBarCode1.Write(BARCODE_DM_DEF, "Data Matrix Default Size", 1, 1, 0, 0)
If nRet = 0 Then
   strMsg = "Barcode Size: " + Chr(13) + ;
            "StartX = " + Str(ThisForm.LEADBarCode1.StartX) + Chr(13) + ;
            "StartY = " + Str(ThisForm.LEADBarCode1.StartY) + Chr(13) + ;
            "SizeX = " + Str(ThisForm.LEADBarCode1.SizeX) + Chr(13) + ;
            "SizeY = " + Str(ThisForm.LEADBarCode1.SizeY)

   MessageBox(strMsg, 0, "Notice!")
Else
   strMsg = "Error occurred in the Write method. Error No. = " + Str(nRet)
   MessageBox(strMsg, 16, "Error!")
EndIf

ThisForm.LEADBarCode1.Bitmap = 0 && release the reference to the bitmap


GetFirstDuplicated example for Visual FoxPro 6.0

#define ERROR_FAILURE 20000
If ThisForm.LEADBarCode1.IsDuplicated(0) != 0 Then
   nDupIndex = ThisForm.LEADBarCode1.GetFirstDuplicated(0)
   nDupCount = ThisForm.LEADBarCode1.GetDuplicatedCount(0)

   strMsg = "This barcode was found in " + Str(nDupCount) + " different locations."
   MessageBox(strMsg, 64, "Notice!")

   If nDupIndex >= ERROR_FAILURE Then
      strMsg = "Error occurred in the GetFirstDuplicated method. Error No. = " + Str(nDupIndex)
      MessageBox(strMsg, 16, "Error!")
   Else
      && Display the first duplicate barcode information.
      With ThisForm.LEADBarCode1.BarCodeData(nDupIndex)
         strMsg = "No. " + Str(nDupIndex) + Chr(13) + ;
                  "Type " + Str(.Type) + Chr(13) + ;
                  "Units " + Str(.Units) + Chr(13) + ;
                  "Data is " + .Data + Chr(13) + ;
                  "PosX " + Str(.Left) + Chr(13) + ;
                  "PosY " + Str(.Top) + Chr(13) + ;
                  "Width " + Str(.Width) + Chr(13) + ;
                  "Height " + Str(.Height) + Chr(13)
         MessageBox(strMsg, 64, "BarCode Info.")
      EndWith

      nDupIndex = ThisForm.LEADBarCode1.GetNextDuplicated(nDupIndex)
      If nDupIndex >= ERROR_FAILURE Then
         strMsg = "Error occurred in the GetNextDuplicated method. Error No. = " + Str(nDupIndex)
         MessageBox(strMsg, 16, "Error!")
      Else
         && Display the next duplicate barcode information.
         With ThisForm.LEADBarCode1.BarCodeData(nDupIndex)
            strMsg = "No. " + Str(nDupIndex) + Chr(13) + ;
                      "Type " + Str(.Type) + Chr(13) + ;
                      "Units " + Str(.Units) + Chr(13) + ;
                      "Data is " + .Data + Chr(13) + ;
                      "PosX " + Str(.Left) + Chr(13) + ;
                      "PosY " + Str(.Top) + Chr(13) + ;
                      "Width " + Str(.Width) + Chr(13) + ;
                      "Height " + Str(.Height) + Chr(13)
            MessageBox(strMsg, 64, "BarCode Info.")
         EndWith
      EndIf
   EndIf
Else
   MessageBox("This Barcode is not duplicated ...", 16, "Error!")
EndIf


PDFRead example for Visual FoxPro 6.0

#define BARCODE_DIR_LEFT_TO_RIGHT 1
#define L_SUPPORT_BARCODES_PDF_READ 12
#define BARCODE_PDF417 8192

&& Unlock PDF read support.
&& Note that this is a sample key, which will not work in your toolkit
ThisForm.LEADBarCode1.UnlockSupport(L_SUPPORT_BARCODES_PDF_READ, "TestKey")

ThisForm.LEADBarCode1.Bitmap = ThisForm.LEAD1.Bitmap
ThisForm.LEADBarCode1.EnableMethodErrors = .F.

ThisForm.LEADBarCode1.PDFRead.Direction = BARCODE_DIR_LEFT_TO_RIGHT

&& The Read method will search for the first 10 occurrences of the (PDF 417)
&& barcode type in the whole bitmap.
nRet = ThisForm.LEADBarCode1.Read(BARCODE_PDF417, 10, 0, 0, 0, 0)

If nRet = 0 Then
   strBarMsg = "Total Bar Code Symbols Found = " + Str(ThisForm.LEADBarCode1.TotalCount)
   MessageBox(strBarMsg, 64, "Bar Code Count")

   For I = 0 To ThisForm.LEADBarCode1.TotalCount - 1
      With ThisForm.LEADBarCode1.BarCodeData(I)
         strBarMsg = "No. " + Str(I) + Chr(13) + ;
                   "Type " + Str(.Type) + Chr(13) + ;
                   "Units " + Str(.Units) + Chr(13) + ;
                   "Data is " + .Data + Chr(13) + ;
                   "PosX " + Str(.Left) + Chr(13) + ;
                   "PosY " + Str(.Top) + Chr(13) + ;
                   "Width " + Str(.Width) + Chr(13) + ;
                   "Height " + Str(.Height) + Chr(13)
         MessageBox(strBarMsg, 64, "BarCode Info.")
      EndWith
   Next
Else
   strBarMsg = "Error occurred in the Read method. Error No. = " + Str(nRet)
   MessageBox(strBarMsg, 16, "Error!")
EndIf
ThisForm.LEADBarCode1.Bitmap = 0


PDFWrite example for Visual FoxPro 6.0

#define L_SUPPORT_BARCODES_PDF_WRITE  13
#define BARCODE_INCHES 1
#define BARCODE_INITREADER                0x0040
#define BARCODE_PDF417                    0x00002000
#define BARCODE_TRUNCATE                  0x0010
#define BARCODE_PDF417_ECCUSE_PERCENT     0x0FFF

&& Unlock PDF barcode write support.
&& Note that this is a sample key, which will not work in your toolkit

ThisForm.LEADBarCode1.UnlockSupport(L_SUPPORT_BARCODES_PDF_WRITE, "TestKey")
ThisForm.LEADBarCode1.Bitmap = ThisForm.LEAD1.Bitmap

ThisForm.LEADBarCode1.Units = BARCODE_INCHES
With ThisForm.LEADBarCode1.PDFWrite
   .ECCLevel = BARCODE_PDF417_ECCUSE_PERCENT
   .ECCPercent = 50
   .Module = 21
   .ModuleAspectRatio = 4
EndWith

ThisForm.LEADBarCode1.WriteFlags = BitOr(BARCODE_INITREADER, BARCODE_TRUNCATE)

nRet = ThisForm.LEADBarCode1.Write(BARCODE_PDF417, "PDF417 Symbol", 1, 1, 0, 0)
If nRet = 0 Then
   ThisForm.LEAD1.ForceRepaint()
Else
   strErrMsg = "Error occurred in the Write method. Error No. = " + Str(nRet)
   MessageBox(strErrMsg, 16, "Error!")
EndIf

ThisForm.LEADBarCode1.Bitmap = 0 && release the reference to the bitmap


Read example for Visual FoxPro 6.0

#define L_SUPPORT_BARCODES_1D 9
#define BARCODE_DIR_LEFT_TO_RIGHT 1
#define BARCODE_MARKERS                   0x0001
#define BARCODE_BLOCK_SEARCH              0x0002
#define BARCODE_1D_EAN_13 0x00000001

&& Unlock linear barcode support.
&& Note that this is a sample key, which will not work in your toolkit

ThisForm.LEADBarCode1.UnlockSupport(L_SUPPORT_BARCODES_1D, "TestKey")

ThisForm.LEADBarCode1.Bitmap = ThisForm.LEAD1.Bitmap
ThisForm.LEADBarCode1.EnableMethodErrors = .F.
ThisForm.LEADBarCode1.EnableUseRegion = .T.
ThisForm.LEADBarCode1.ReadFlags = BitOr(BARCODE_MARKERS, BARCODE_BLOCK_SEARCH)

ThisForm.LEADBarCode1.SpaceColor = RGB(0, 0, 255)
ThisForm.LEADBarCode1.BarColor = RGB(255, 0, 0)
ThisForm.LEADBarCode1.EnableUseColors = .T.

With ThisForm.LEADBarCode1.Linear
   .EnableErrorCheck = .T.
   .Granularity = 9
   .ReadDirection = BARCODE_DIR_LEFT_TO_RIGHT
EndWith

&& The Read method will search for the first 10 occurrences of the (EAN 13) barcode type
&& in the bitmap region. If the bitmap does not have a region, the Read method will
&& search for (EAN 13) barcodes in the whole bitmap.

nRet = ThisForm.LEADBarCode1.Read(BARCODE_1D_EAN_13, 10, 0, 0, 0, 0)

If nRet = 0 Then
   strBarMsg = "Total Bar Code Symbols Found = " + Str(ThisForm.LEADBarCode1.TotalCount)
   MessageBox(strBarMsg, 64, "Bar Code Count")

   For I = 0 To ThisForm.LEADBarCode1.TotalCount - 1
      With ThisForm.LEADBarCode1.BarCodeData(I)
         strBarMsg = "No. " + Str(I) + Chr(13) + ;
                   "Type " + Str(.Type) + Chr(13) + ;
                   "Units " + Str(.Units) + Chr(13) + ;
                   "Data is " + .Data + Chr(13) + ;
                   "PosX " + Str(.Left) + Chr(13) + ;
                   "PosY " + Str(.Top) + Chr(13) + ;
                   "Width " + Str(.Width) + Chr(13) + ;
                   "Height " + Str(.Height) + Chr(13)
         MessageBox(strBarMsg, 64, "BarCode Info.")
      EndWith
   Next
Else
   strBarMsg = "Error occurred in the Read method. Error No. = " + Str(nRet)
   MessageBox(strBarMsg, 16, "Error!")
EndIf
ThisForm.LEADBarCode1.Bitmap = 0


UnlockSupport example for Visual FoxPro 6.0

#DEFINE L_SUPPORT_BARCODES_DATAMATRIX_READ    32
If 0 != ThisForm.LEADBarCode1.IsSupportLocked(L_SUPPORT_BARCODES_DATAMATRIX_READ) Then
   && Unlock Data Matrix Read support.
   && Note that this is a sample key, which will not work in your toolkit
   ThisForm.LEADBarCode1.UnlockSupport(L_SUPPORT_BARCODES_DATAMATRIX_READ, "TestKey")
Else
   MessageBox("BARCODES_DATAMATRIX_READ support is unlocked")
EndIf


Write example for Visual FoxPro 6.0

#define L_SUPPORT_BARCODES_DATAMATRIX_WRITE 33
#define BARCODE_INCHES 1
#define BARCODE_JUSTIFY_RIGHT             0x1000
#define BARCODE_INITREADER                0x0040
#define BARCODE_DISABLE_COMPRESSOPN       0x0100
#define BARCODE_DM_DEF                    0x00000101

&& Unlock Data Matrix write support.
&& Note that this is a sample key, which will not work in your toolkit

ThisForm.LEADBarCode1.UnlockSupport(L_SUPPORT_BARCODES_DATAMATRIX_WRITE, "TestKey")
ThisForm.LEADBarCode1.Bitmap = ThisForm.LEAD1.Bitmap

ThisForm.LEADBarCode1.Units = BARCODE_INCHES
ThisForm.LEADBarCode1.WriteFlags = BitOr(BARCODE_INITREADER, BARCODE_DISABLE_COMPRESSOPN)
ThisForm.LEADBarCode1.DataMatrixWrite.Flags = BARCODE_JUSTIFY_RIGHT

ThisForm.LEADBarCode1.SpaceColor = RGB(0, 0, 255)
ThisForm.LEADBarCode1.EnableTransparent = .T.
ThisForm.LEADBarCode1.EnableUseColors = .T.

nRet = ThisForm.LEADBarCode1.Write(BARCODE_DM_DEF, "Data Matrix Default Size", 1, 1, 0, 0)
If nRet = 0 Then
   ThisForm.LEAD1.ForceRepaint()
Else
   strErrMsg = "Error occurred in the Write method. Error No. = " + Str(nRet)
   MessageBox(strErrMsg, 16, "Error!")
EndIf

ThisForm.LEADBarCode1.Bitmap = 0 && release the reference to the bitmap


Tutorial for Delphi 6 Programmers
Tutorial for Delphi Programmers

The following topics provide brief and simple examples to help you learn how to use the LEADTOOLS Barcode ActiveX from within Delphi 6.

Reading Barcodes

Writing Barcodes

Finding Duplicated Barcodes


Reading Barcodes (Delphi 6)

Take the following steps to start a project and to add some code that searches for barcodes in a bitmap:

1.	Start Delphi 6.
2.	If you didn’t install LEAD BarCode Control, install it as follows.
	On the Component pull-down menu, use the Import ActiveX Control… and select the LEAD BarCode Control (14.5). Press Install, and then compile and install the package dclusr.dpk.
3.	From the ActiveX controls tab, add the LEAD BarCode control to your form.
4.	On the Delphi toolbar, click the LEADTOOLS tab. If you have used a LEAD VCL control before, the icon appears on the toolbar. Otherwise, refer to Installing VCL before continuing with this tutorial.
5.	Select the LEAD Main control on the VCL toolbar. Size and position the control, as you want it to appear at run time.
6.	Add two button controls to your form and name them as follows:
	Name	Caption
	btnLoadLead	Load Image
	btnReadBar	Read Bar Code
7.	Declare the following procedure in the private section of Unit1.
Procedure DisplayBarCodeInfo ( iIndex: Integer );

8.	Handle the btnLoadLead OnClick event, and code btnLoadLeadClick procedure as follows.
procedure TForm1.btnLoadLeadClick(Sender: TObject);
begin
   LEADImage1.Load ( 'E:\Images\barcode1.tif', 0, 0, 1 );
end;

9.	Handle the btnReadBar OnClick event, and code btnReadBarClick procedure as follows.
procedure TForm1.btnReadBarClick(Sender: TObject);
var
   i: Integer;
   nRet: Integer;
   strBarMsg: String;
begin
   //Unlock linear barcode support.
   //Note that this is a sample key, which will not work in your toolkit
   LEADBarCode1.UnlockSupport ( L_SUPPORT_BARCODES_1D, 'TestKey' );
   LEADBarCode1.Bitmap:= LEADImage1.OCXBitmap ;
   LEADBarCode1.EnableMethodErrors:= False;
   LEADBarCode1.EnableUseRegion:= True;

   With LEADBarCode1.Linear do
   begin
      EnableErrorCheck:= True;
      Granularity:= 9;
      ReadDirection:= BARCODE_DIR_LEFT_TO_RIGHT;
   end;
   //The Read method will search for all linear barcodes in the bitmap
   nRet:= LEADBarCode1.Read ( BARCODE_1D_READ_ANYTYPE, 0, 0, 0, 0, 0 );

   if ( nRet = 0 ) then
   begin
      strBarMsg:= 'Total Bar Code Symbols Found =: ' + IntToStr(LEADBarCode1.TotalCount);
      MessageBox ( Handle, PChar(strBarMsg), 'Bar Code Count', MB_ICONINFORMATION + MB_OK );

      for I:= 0 To LEADBarCode1.TotalCount - 1 do
         DisplayBarCodeInfo ( i ) ;
   end
   else
   begin
      strBarMsg:= 'Error occurred in the Read method. Error No. = ' + IntToStr(nRet);
      MessageBox ( Handle, PChar(strBarMsg), 'Error!', MB_ICONWARNING + MB_OK );
   end;
   LEADBarCode1.Bitmap:= 0; // release the reference to the bitmap
end;

10.	Add the DisplayBarCodeInfo procedure body to Unit1.
Procedure TForm1.DisplayBarCodeInfo ( iIndex: Integer );
var
strBarMsg: String;
begin
   With LEADBarCode1.BarCodeData[iIndex] do
   begin
      strBarMsg:= 'No. ' + IntToStr (iIndex) + Chr(13) +
                  'Type ' + IntToStr(Type_) + Chr(13) +
                  'Units ' + IntToStr(Units) + Chr(13) +
                  'Data is ' + Data + Chr(13) +
                  'PosX ' + IntToStr(Left) + Chr(13) +
                  'PosY ' + IntToStr(Top) + Chr(13) +
                  'Width ' + IntToStr(Width) + Chr(13) +
                	'Height ' + IntToStr(Height) + Chr(13)
   end;
   MessageBox ( Handle, PChar(strBarMsg), 'BarCode Info.', MB_ICONINFORMATION + MB_OK );
end;

11.	Run your program to test it.
12.	Save the project to use as a starting point for other tasks in this tutorial.


Writing Barcodes (Delphi 6)

Take the following steps to add some code that writes a barcode over the bitmap:

1.	Start with the project that you created in the Reading Barcodes Tutorial for Delphi 6.
2.	Add a button control to your form and name it as follows:
	Name	Caption
	btnWriteBar	Write Bar Code
3.	Handle the btnWriteBar OnClick event, and code btnWriteBarClick procedure as follows.
procedure TForm1.btnWriteBarClick(Sender: TObject);
var
   nRet: Integer;
   strErrMsg: String;
begin
   //Unlock linear barcode support.
   //Note that this is a sample key, which will not work in your toolkit

   LEADBarCode1.UnlockSupport ( L_SUPPORT_BARCODES_1D, 'TestKey' );
   LEADBarCode1.Bitmap:= LEADImage1.OCXBitmap;

   LEADBarCode1.Units:= BARCODE_INCHES;
   With LEADBarCode1.Linear do
   begin
      EnableErrorCheck:= True;
      EnableWriteText:= True;
   end;

   nRet:= LEADBarCode1.Write ( BARCODE_1D_EAN_13, '012345678901', 50, 50, 150, 50 );
   if ( nRet = 0 ) then
begin
LEADImage1.OCXBitmap:= LEADBarCode1.Bitmap;
      LEADImage1.ForceRepaint();
end
   else
   begin
      strErrMsg:= 'Error occurred in the Write method, Error No. = ' + IntToStr(nRet);
      MessageBox ( Handle, PChar(strErrMsg), 'Error!', MB_ICONWARNING + MB_OK );
   end;

   LEADBarCode1.Bitmap:= 0; // release the reference to the bitmap
end;

4.	Run your program to test it.
5.	Save the project to use as a starting point for other tasks in this tutorial.


Finding Duplicated Barcodes (Delphi 6)

Take the following steps to add code that can find duplicated barcodes in the bitmap.

1.	Start with the project that you created in the Reading Barcodes Tutorial for Delphi 6.
2.	Add a button control to your form and name it as follows:
	Name	Caption
	btnFindDupBar	Find Duplicate
3.	Handle the btnFindDupBar OnClick event, and code btnFindDupBarClick procedure as follows.
procedure TForm1.btnFindDupBarClick(Sender: TObject);
var
   strMsg: String;
   nDupIndex: Integer;
begin
   if ( LEADBarCode1.IsDuplicated (4) = 1 ) then
   begin
      nDupIndex:= LEADBarCode1.GetFirstDuplicated (4);
      if ( nDupIndex >= 20000 ) then
      begin
         strMsg:= 'Error occurred in the GetFirstDuplicated method. Error No. = ' + IntToStr(nDupIndex);
         MessageBox ( Handle, PChar(strMsg), 'Error!', MB_ICONWARNING + MB_OK );
      end
      else
      begin
         //Display the first duplicated barcode information.
         DisplayBarCodeInfo ( nDupIndex );

         nDupIndex:= LEADBarCode1.GetNextDuplicated(nDupIndex);
         if ( nDupIndex >= 20000 ) then
         begin
            strMsg:= 'Error occurred in the GetNextDuplicated method. Error No. = ' + IntToStr(nDupIndex);
            MessageBox ( Handle, PChar(strMsg), 'Error!', MB_ICONWARNING + MB_OK );
         end
         else
            //Display the next duplicated barcode information.
            DisplayBarCodeInfo ( nDupIndex );
      end;
   end
   else
      MessageBox ( Handle, PChar('This barcode is not duplicated ...'), 'Error!', MB_ICONWARNING + MB_OK );
end;

4.	Run your program to test it.


Miscellaneous Examples (Delphi 6)

You can test any of the following examples by adding a command button and pasting the sample code in the Click procedure.

EnableGetSizeMethod example for Visual Basic

GetFirstDuplicated Example for Visual Basic

PDFRead example for Visual Basic

PDFWrite Example for Visual Basic

Read Example for Visual Basic

UnlockSupport example for Visual Basic

Write example for Visual Basic


EnableGetSizeMethod Example for Delphi 6
EnableGetSizeMethod example for Delphi

procedure TForm1.Button1Click(Sender: TObject);
var
   nRet: Integer;
   strMsg: String;
begin
   //Unlock write Data Matrix barcode support.
   //Note that this is a sample key, which will not work in your toolkit

   LEADBarCode1.UnlockSupport ( L_SUPPORT_BARCODES_DATAMATRIX_WRITE, 'TestKey' );
   LEADBarCode1.Bitmap:= LEADImage1.Bitmap;

   LEADBarCode1.Units:= BARCODE_SCANLINES_PER_PIXELS;
   LEADBarCode1.DataMatrixWrite.Flags:= BARCODE_JUSTIFY_RIGHT;
   LEADBarCode1.WriteFlags:= BARCODE_INITREADER Or BARCODE_DISABLE_COMPRESSOPN;

   LEADBarCode1.EnableGetSizeMethod:= True;
   nRet:= LEADBarCode1.Write(BARCODE_DM_DEF, 'Data Matrix Default Size', 100, 100, 0, 0);
   if ( nRet = 0 ) then
   begin
      strMsg:= 'Barcode Size: ' + Chr(13) +
               'StartX = ' + IntToStr(LEADBarCode1.StartX) + Chr(13) +
               'StartY = ' + IntToStr(LEADBarCode1.StartY) + Chr(13) +
               'SizeX = ' + IntToStr(LEADBarCode1.SizeX) + Chr(13) +
               'SizeY = ' + IntToStr(LEADBarCode1.SizeY);

      ShowMessage ( strMsg );
   end
   else
   begin
      strMsg:= 'Error occurred in the Write method. Error No. = ' + IntToStr(nRet);
      ShowMessage ( strMsg );
   end;

   LEADBarCode1.Bitmap:= 0; // release the reference to the bitmap
end;


GetFirstDuplicated Example for Delphi 6

procedure TForm1.Button2Click(Sender: TObject);
var
   nDupIndex: Integer;
   nDupCount: Integer;
   strMsg: String;

begin
   if ( LEADBarCode1.IsDuplicated (0)= 1 ) then
   begin
      nDupIndex:=  LEADBarCode1.GetFirstDuplicated(0);
      nDupCount:= LEADBarCode1.GetDuplicatedCount(0);

      strMsg:= 'This Bar Code was found in ' + IntToStr(nDupCount) + ' different locations.';
      ShowMessage ( strMsg );

      If ( nDupIndex >= 20000 ) Then
      begin
         strMsg:= 'Error occurred in the GetFirstDuplicated method. Error No. = ' + IntToStr(nDupIndex);
         ShowMessage ( strMsg );
      end
      else
      begin
         //Display the first duplicate barcode information.
         strMsg:= 'No. ' + IntToStr(nDupIndex) + Chr(13) +
                  'Type ' + IntToStr(LEADBarCode1.BarCodeData[nDupIndex].Type_) + Chr(13) +
                  'Units ' + IntToStr(LEADBarCode1.BarCodeData[nDupIndex].Units) + Chr(13) +
                  'Data is ' + LEADBarCode1.BarCodeData[nDupIndex].Data + Chr(13) +
                  'PosX ' + IntToStr(LEADBarCode1.BarCodeData[nDupIndex].Left) + Chr(13) +
                  'PosY ' + IntToStr(LEADBarCode1.BarCodeData[nDupIndex].Top) + Chr(13) +
                  'Width ' + IntToStr(LEADBarCode1.BarCodeData[nDupIndex].Width) + Chr(13) +
                  'Height ' + IntToStr(LEADBarCode1.BarCodeData[nDupIndex].Height) + Chr(13);
         ShowMessage ( strMsg );
         nDupIndex:= LEADBarCode1.GetNextDuplicated(nDupIndex);
         If ( nDupIndex >= 20000 ) Then
         begin
            strMsg:= 'Error occurred in the GetNextDuplicated method. Error No. = ' + IntToStr(nDupIndex);
             ShowMessage ( strMsg );
         end
         else
         begin
            //Display the next duplicate barcode information.
            strMsg:= 'No. ' + IntToStr(nDupIndex) + Chr(13) +
                     'Type ' + IntToStr(LEADBarCode1.BarCodeData[nDupIndex].Type_) + Chr(13) +
                     'Units ' + IntToStr(LEADBarCode1.BarCodeData[nDupIndex].Units) + Chr(13) +
                     'Data is ' + LEADBarCode1.BarCodeData[nDupIndex].Data + Chr(13) +
                     'PosX ' + IntToStr(LEADBarCode1.BarCodeData[nDupIndex].Left) + Chr(13) +
                     'PosY ' + IntToStr(LEADBarCode1.BarCodeData[nDupIndex].Top) + Chr(13) +
                     'Width ' + IntToStr(LEADBarCode1.BarCodeData[nDupIndex].Width) + Chr(13) +
                     'Height ' + IntToStr(LEADBarCode1.BarCodeData[nDupIndex].Height) + Chr(13);
            ShowMessage ( strMsg );
            end;
      end;
   end
   else
      ShowMessage ( 'This Barcode is not duplicated ...' );
end;


PDFRead example for Delphi 6

procedure TForm1.Button3Click(Sender: TObject);
var
   nRet: Integer;
   I: Integer;
   strBarMsg: String;
begin
//Unlock read PDF barcodes support.
   //Note that this is a sample key, which will not work in your toolkit
   LEADBarCode1.UnlockSupport ( L_SUPPORT_BARCODES_PDF_READ, 'TestKey' );

   LEADBarCode1.Bitmap:= LEADImage1.Bitmap;
   LEADBarCode1.EnableMethodErrors:= False;

   LEADBarCode1.PDFRead.Direction:= BARCODE_DIR_LEFT_TO_RIGHT;

   // The Read method will search for the first 10 occurrences of the (PDF 417)
   //barcode type in the whole bitmap.
   nRet:= LEADBarCode1.Read(BARCODE_PDF417, 10, 0, 0, 0, 0);

   if ( nRet = 0 ) then
   begin
      strBarMsg:= 'Total Bar Code Symbols Found = ' + IntToStr(LEADBarCode1.TotalCount);
      ShowMessage ( strBarMsg );

      for I:= 0 To LEADBarCode1.TotalCount - 1 do
      begin
         strBarMsg:= 'No. ' + IntToStr(I) + Chr(13) +
                     'Type ' + IntToStr(LEADBarCode1.BarCodeData[I].Type_) + Chr(13) +
                     'Units ' + IntToStr(LEADBarCode1.BarCodeData[I].Units) + Chr(13) +
                     'Data is ' + LEADBarCode1.BarCodeData[I].Data + Chr(13) +
                     'PosX ' + IntToStr(LEADBarCode1.BarCodeData[I].Left) + Chr(13) +
                     'PosY ' + IntToStr(LEADBarCode1.BarCodeData[I].Top) + Chr(13) +
                     'Width ' + IntToStr(LEADBarCode1.BarCodeData[I].Width) + Chr(13) +
                     'Height ' + IntToStr(LEADBarCode1.BarCodeData[I].Height) + Chr(13);
         ShowMessage ( strBarMsg );
      end;
   end
   else
   begin
      strBarMsg:= 'Error occurred in the Read method. Error No. = ' + IntToStr(nRet);
      ShowMessage ( strBarMsg );
   end;
   LEADBarCode1.Bitmap:= 0;
end;


PDFWrite Example for Delphi 6

procedure TForm1.Button4Click(Sender: TObject);
var
   nRet: Integer;
   strErrMsg: String;

begin
   //Unlock write PDF barcodes support.
   //Note that this is a sample key, which will not work in your toolkit

   LEADBarCode1.UnlockSupport ( L_SUPPORT_BARCODES_PDF_WRITE, 'TestKey' );
   LEADBarCode1.Bitmap:= LEADImage1.Bitmap;

   LEADBarCode1.Units:= BARCODE_SCANLINES_PER_PIXELS;

   LEADBarCode1.PDFWrite.ECCLevel:= BARCODE_PDF417_ECCUSE_PERCENT;
   LEADBarCode1.PDFWrite.ECCPercent:= 50;
   LEADBarCode1.PDFWrite.Module:= 21;
   LEADBarCode1.PDFWrite.ModuleAspectRatio:= 4;

   LEADBarCode1.WriteFlags:= BARCODE_INITREADER Or BARCODE_TRUNCATE;

   nRet:= LEADBarCode1.Write(BARCODE_PDF417, 'PDF417 Symbol', 100, 100, 0, 0);
   If (nRet = 0) Then
      LEADImage1.ForceRepaint ( )
   else
   begin
      strErrMsg:= 'Error occurred in the Write method. Error No. = ' + IntToStr(nRet);
      ShowMessage ( strErrMsg );
   end;

   LEADBarCode1.Bitmap:= 0; // release the reference to the bitmap
end;


Read Example for Delphi 6

procedure TForm1.Button5Click(Sender: TObject);
var
   I: Integer;
   nRet: Integer;
   strBarMsg: String;
begin

   //Unlock linear barcode support.
   //Note that this is a sample key, which will not work in your toolkit

   LEADBarCode1.UnlockSupport ( L_SUPPORT_BARCODES_1D, 'TestKey' );

   LEADBarCode1.Bitmap:= LEADImage1.Bitmap;
   LEADBarCode1.EnableMethodErrors := False;
   LEADBarCode1.EnableUseRegion := True;
   LEADBarCode1.ReadFlags := BARCODE_MARKERS Or BARCODE_BLOCK_SEARCH;

   LEADBarCode1.SpaceColor := RGB(0, 0, 255);
   LEADBarCode1.BarColor := RGB(255, 0, 0);
   LEADBarCode1.EnableUseColors := TRUE;

   LEADBarCode1.Linear.EnableErrorCheck := True;
   LEADBarCode1.Linear.Granularity := 9;
   LEADBarCode1.Linear.ReadDirection := BARCODE_DIR_LEFT_TO_RIGHT;

   // The Read method will search for the first 10 occurrences of the (EAN 13) barcode type
   // in the bitmap region. If the bitmap does not have a region, the Read method will
   // search for (EAN 13) barcodes in the whole bitmap.

   nRet := LEADBarCode1.Read(BARCODE_1D_EAN_13, 10, 0, 0, 0, 0);

   If ( nRet = 0 ) then
   begin
      strBarMsg := 'Total Bar Code Symbols Found := ' + IntToStr(LEADBarCode1.TotalCount);
      ShowMessage ( strBarMsg );

      For I := 0 To LEADBarCode1.TotalCount - 1 do
      begin
         strBarMsg := 'No. ' + IntToStr(I) + Chr(13) +
                      'Type ' + IntToStr(LEADBarCode1.BarCodeData[I].Type_) + Chr(13) +
                      'Units ' + IntToStr(LEADBarCode1.BarCodeData[I].Units) + Chr(13) +
                      'Data is ' + LEADBarCode1.BarCodeData[I].Data + Chr(13) +
                      'PosX ' + IntToStr(LEADBarCode1.BarCodeData[I].Left) + Chr(13) +
                      'PosY ' + IntToStr(LEADBarCode1.BarCodeData[I].Top) + Chr(13) +
                      'Width ' + IntToStr(LEADBarCode1.BarCodeData[I].Width) + Chr(13) +
                      'Height ' + IntToStr(LEADBarCode1.BarCodeData[I].Height) + Chr(13);
            ShowMessage ( strBarMsg );
      end;
   end
   else
   begin
      strBarMsg := 'Error occurred in the Read method. Error No. := ' + IntToStr(nRet);
      ShowMessage ( strBarMsg );
   end;
   LEADBarCode1.Bitmap := 0
end;


UnlockSupport example for Delphi 6

procedure TForm1.btnSupportLockClick(Sender: TObject);
begin
   if ( LEADBarCode1.IsSupportLocked(L_SUPPORT_BARCODES_DATAMATRIX_READ) = 1) then
   begin
      //Unlock Data Matrix Read support.
      //Note that this is a sample key, which will not work in your toolkit
      LEADBarCode1.UnlockSupport ( L_SUPPORT_BARCODES_DATAMATRIX_READ, 'TestKey' );
   end;
end;


Write example for Delphi 6

procedure TForm1.btnWriteClick(Sender: TObject);
var
   nRet: Integer;
   strErrMsg: String;

begin
   //Unlock write Data Matrix barcode support.
   //Note that this is a sample key, which will not work in your toolkit

   LEADBarCode1.UnlockSupport ( L_SUPPORT_BARCODES_DATAMATRIX_WRITE, 'TestKey' );
   LEADBarCode1.Bitmap:= LEADImage1.Bitmap;

   LEADBarCode1.Units:= BARCODE_SCANLINES_PER_PIXELS;;
   LEADBarCode1.WriteFlags:= BARCODE_INITREADER Or BARCODE_DISABLE_COMPRESSOPN;
   LEADBarCode1.DataMatrixWrite.Flags:= BARCODE_JUSTIFY_RIGHT;

   LEADBarCode1.SpaceColor:= RGB(0, 0, 255);
   LEADBarCode1.EnableTransparent:= True;
   LEADBarCode1.EnableUseColors:= True;

   nRet:= LEADBarCode1.Write(BARCODE_DM_DEF, 'Data Matrix Default Size', 100, 100, 0, 0);
   if ( nRet = 0 ) then
      LEADImage1.ForceRepaint
   else
   begin
      strErrMsg:= 'Error occurred in the Write method. Error No. = ' + IntToStr(nRet);
      ShowMessage ( strErrMsg );
   end;
   LEADBarCode1.Bitmap:= 0; // release the reference to the bitmap
end;