Linear Barcode ActiveX Control & DLL

 
Home Products Demos Support Integration Barcode FAQ Order Now Contact Us

 

Home:  Products:  Barcode Components:  Barcode ActiveX and DLL:  User Manual
 

ActiveX Barcode Control & DLL User Manual & Tutorial

Index:

It is important to have the ability to test printed barcodes with a barcode scanner.
If a scanner is not available for testing purposes, IDAutomation also provides hand-held barcode scanner kits.

ActiveX Barcode Control Installation & Overview

The IDAutomation ActiveX Barcode Control supports several Linear and 2D barcode symbologies without the use of fonts. They are easy-to-use, "drag and drop" graphic objects that are compatible with Windows applications that support ActiveX including Microsoft Access, Word, Excel, InfoPath, Visual Basic, C++, FrontPage and Internet Explorer web pages. IDAutomation ActiveX Barcode Controls also function as DLLs that generate, print and save WMF images.

Three basic steps must be executed to utilize the IDAutomation ActiveX Barcode Control:

  1. Install and register the control in Windows:
    Install the ActiveX Barcode Control package by running the executable file included in the package; this will register the control in Windows and install several implementation examples. The barcode control must be installed and registered in Windows before an application will be able to "identify" it. If desired, the DLL may also be registered manually from the command line by executing REGSVR32 DLLNAME at the prompt where DLLNAME is the name of the ActiveX DLL in the current directory.
  2. Install the barcode control in the desired application:
    After the control has been installed and registered on the PC, it may be activated in any application that supports ActiveX or COM. Several installation tutorials are included in this document. For applications that are not listed in this document, search the application's help file for information about how to utilize ActiveX controls.
  3. Modify the properties of the control:
    Properties determine the data that will be encoded in the barcode and other options such as the barcode type and size.
Microsoft® Word Installation

ActiveX Barcode Controls cannot be linked to a mail-merge field in Microsoft Word. If this implementation is needed, IDAutomation suggests using barcode fonts, which may be easily linked to a mail-merge source. More information about this subject is provided in the Microsoft Word Barcode Tutorial.

  1. In Microsoft® Word, choose View - Toolbars - Control Toolbox. There should now be a toolbox visible. On the toolbox, choose the "more controls button".
    Microsoft Control Toolbox button
  2. Select the barcode control from the list of available ActiveX Controls and the control will appear in the document.
  3. Size the control as necessary.
  4. To change the properties of the control such as barcode height and symbology type, right-click on the control and choose properties. When finished, click on the "design mode button."
    Word design mode button
  5. To edit the properties of the barcode control, the user must be in design mode. If problems are encountered editing the properties of the control, press the design mode button to enable it.
  6. The data encoded in the barcode may be either static or modified with the use of VBA code.
Microsoft® Access Installation

IDAutomation ActiveX Barcode Controls work very well in Microsoft Access. When used in reports and forms, the controls may be dragged into the design area and easily connected to database fields.

  1. Binding the ActiveX Barcode to the Data Source.Open the report in design mode.
  2. Choose insert - ActiveX control.
  3. Move and size the control necessary. To change the properties of the control, such as barcode height and symbology type, right click on the control and choose properties.
  4. To bind the barcode to a data source, select the table in the control source field in the same manner as for a text control.
  5. Verify the correct data is encoded in the barcode. If it does not, consult Access Help to determine how to get the correct data in the Control Source field. The result of the Control Source is what will be encoded in the barcode. IDAutomation recommends using a barcode scanner to verify that the correct data has been properly encoded. When working with multiple tables, it may be necessary to specify both the table and field in the control source,
    for example: =([Table1.Field1])
  6. Optional: A single formula or VB Script may be used in the control source property, which allows the combining of multiple fields and/or prefix and suffix values. For example:
    ="PREFIX" & [Field1]
    =[Field1] & [Field2]
    =[Field1] & "," & [Field2]

    =("PrefixText"&[Table1.Field1] & "~009" & [Table1.Field2] & "SuffixText")

NOTE: When distributing Access Databases, the ActiveX Barcode Control must be installed on each computer used to print barcodes. For a simpler solution, IDAutomation also offers the Native Barcode Generator for Access, which is a complete barcode generator object that stays embedded in the database.

Microsoft® Excel Installation

ActiveX Barcode Controls may easily be used in Microsoft Excel and may be modified by referencing a cell or via the use of VBA code. ActiveX Controls cannot be used to easily populate a column in Excel; they must be placed one at a time. If this type of implementation is needed, IDAutomation suggests using barcode fonts, which can be easily used to produce a column of barcodes.

  1. In Microsoft Excel, choose View - Toolbars - Control Toolbox. There should now be a toolbox visible. On the tool box, choose the "more controls button."
    Microsoft® Excel Control Toolbox
  2. Select the barcode control from the list of available ActiveX Controls. Click and drag the control for desired placement in the spreadsheet and size it as necessary.
  3. To modify the properties of the control, such as barcode height and symbology type, right-click on the control and choose properties. When finished, click on the "design mode button."
  4. To edit the properties of the control, the user must be in design mode. If problems are experienced when editing the properties of the control, press the design mode button to enable it.
  5. To link a cell to the data that is to be encoded in the barcode, enter the cell in the "LinkedCell" property of the control.
Microsoft® FrontPage and HTML Installation

ActiveX Barcode Controls may be used in HTML or Microsoft FrontPage to create barcodes in dynamically generated webpages, as demonstrated in the JavaScript Example. ActiveX Controls only work with Internet Explorer and other browsers that support ActiveX. If it is determined that support for other browsers is needed, IDAutomation suggests reviewing the Internet Barcode FAQ.

To use the control in FrontPage:

  1. In FrontPage, choose Insert - Advanced - ActiveX Control (In FrontPage 2003, choose Insert - Web Component - Advanced Controls - ActiveX Control). If the control does not appear in the list, choose Customize to add it to the list of controls. Choose Finish.
  2. The control will appear in the web page. Right-click on the control to adjust properties as necessary.
  3. The control must be installed on every PC that accesses the web page displaying the ActiveX control. To enable the control to automatically install (if it is not already installed), enter the file name and path of the signed CAB file, which is provided in the download package. IDAutomation supplies signed CAB files in the package for this purpose. IDAutomation also provides an online example of installing the ActiveX Barcode with a CAB file.
    Barcode ActiveX signed CAB file in FrontPage

To use the control in HTML:

  1. Copy and paste the following object code into HTML:
    <object classid="clsid:0C3874AA-AB39-4B5E-A768-45F3CE6C6819" id="IDAutomationBarcode" width="300" height="80" codebase="http://www.yourdomain.com/activex/IDAutomationLinear.cab">
    <param name="DataToEncode" value="Linear ActiveX">
    </object>
     
  2. If the Linear control is not being used, replace the Class ID with the values listed below:
    Aztec:
    EBA15B30-80B4-11DC-B31D-0050C2490048
    DataMatrix:
    DB67DB99-616A-4CAB-A3A1-2EF644F254E7
    MaxiCode:
    3F66852C-5FD8-4E70-A897-ECC1DE14019F
    PDF417:
    E97EE6EB-7FBE-43B1-B6D8-C4D86C78C5A0
  3. Modify width= and height= as necessary to size the area the control will occupy.
  4. Change codebase= to the location of the CAB file.
  5. Modify other properties by specifying the param name= and value= as demonstrated in step 1 with the DataToEncode property.
  6. Using this method, ActiveX may be used to create barcodes in dynamically generated webpages, as demonstrated in the JavaScript Example.
Microsoft® Visual Basic

IDAutomation ActiveX Barcode Controls work well in Visual Basic 6. When Visual Basic.NET is used, IDAutomation suggests using the .NET Forms Barcode Control instead of ActiveX because it is a managed code assembly and is easier to use in .NET. To activate the ActiveX Barcode Control in a VB 6 project, perform the following:

  1. In Visual Basic 6, choose Project - Components from the menu.
  2. Select the barcode control from the list.
  3. Choose View - Toolbox. After the control appears in the toolbox, it may be placed in the VB project.
  4. To change the properties of the control such as barcode height and symbology type, right click on the control and choose properties.
  5. Use "code behind" to modify properties of the control, for example:
    BarCode1.BarHeight=2
    BarCode1.DataToEncode="12345678901"
    BarCode1.SaveEnhWMF "C:\saved-barcode.wmf"

Methods of printing from the ActiveX Barcode Control in Visual Basic include the following:

  1. Print Directly to the Printer - The following print method sends the barcode image graphic directly to the printer. The example below shows how to send a barcode to the printer starting at position X=2048 and Y=1024:
    Private Sub PrintDirect_Click()
       Printer.PaintPicture BarCode1.Picture, 2048, 1024
       Printer.EndDoc
    End Sub
  2. PrintForm - This printing method prints the actual form with the barcode control. This method prints at the screen DPI, therefore, narrow bar widths smaller than .03CM cannot be printed. Below is code from a button on the form that performs this task:
    Private Sub PrintForm_Click()
       Me.PrintForm
    End Sub
  3. Copy to the Clipboard - The following method sends the barcode image graphic directly to clipboard:
    Private Sub CopyToClipboard_Click()
       Clipboard.Clear
       Clipboard.SetData BarCode1.Picture, vbCFMetafile
       'Optionally, display in an image box
       Image1.Picture = BarCode1.Picture
    End Sub
  4. Save to File - The following method saves the barcode image graphic directly to a file that may be imported into an application that can display WMF files such as Microsoft® Word:
    Private Sub SaveToFile_Click()
       BarCode1.SaveEnhWMF "SavedBarCode.wmf"
    End Sub
  5. Use the control as a DLL - The following code loads the barcode control and prints without it being placed on a form:
    Dim BC
    Set BC = CreateObject("IDAuto.BarCode")
    BC.DataToEncode = "DLL-TEST"
    Printer.PaintPicture BC.Picture, 2048, 1024
    Printer.EndDoc
    Set BC = Nothing
Microsoft® Visual C++ Installation
  1. Choose the resource tab in Visual C++ to view dialogs.
  2. To add a control to the dialog, right-click on the dialog form to the right and choose "Insert ActiveX Control."
  3. Select the correct barcode control from the list. The control should then appear in the dialog. Download the C++ project example for an implementation example.
Microsoft® Visual FoxPro Installation
  1. In a Visual Foxpro form, select the "OLE Container" from the standard toolbox.
  2. After the "Insert Object" dialog box opens, select an ActiveX Barcode Control that begins with "IDAutomation".
  3. The characteristics may be modified in the properties window.
  4. To print barcodes on reports or labels, a field must be used to store the barcode and it must be setup as an OLE Control with the data type of "general." Download the IDAutomation VFP barcode example for an implementation example that was created in VFP 6.0.
Adjusting Properties

After activating the barcode control in the application, the properties of the control may be modified by code or by right-clicking on the control and selecting the properties option.

Properties
IDAutomation recommends using default values for all properties, unless requirements dictate otherwise.
Name Default Description
AddCheckDigit 1 AddCheckDigit automatically adds the check digit to the barcode if it is equal to 1. The check digit is required for all symbologies except Code 39, Industrial 2 of 5 and Codabar barcodes.
AddCheckDigitToText 1 AddCheckDigitToText automatically adds the check digit that is encoded in the barcode to the human readable text that is displayed if it is equal to 1.
ApplyTilde 1 When ApplyTilde is set to "1" in Code 128 with the Auto character set, the format ~ddd may be used to specify the ASCII code of the character to be encoded and several other tilde options are enabled.
BackColor 16777215 The background color of the barcode specified as a number defined by the Visual Basic Color Constant. The background color represented as an integer number from 0 (black) to 16777215 (white) obtained by combining the red, green, and blue values (each ranging from 0 to 255) to represent a color with the following formula: ((red * 1) + (green * 256) + (blue * 65,536)).
BarHeight 1 The height of the barcode in centimeters (CM).
BearerBarHorizontal 0 The width of the horizontal bearer bars as a multiple of the XDimension; valid options are 0-10.
BearerBarVertical 0 The width of the vertical bearer bars as a multiple of the XDimension; valid options are 0-10.
CodabarStartCharacter A The Start Character in the Codabar barcode.
CodabarStopCharacter B The Stop Character in the Codabar barcode.
Code128CharSet 0 The set of characters to be used in Code128. Valid values are: Auto=0, A=1, B=2 or C=3. IDAutomation recommends using Auto.
DataToEncode na DataToEncode is the data which is to be encoded in the barcode. If the barcode control is connected to a control source, the source will override this property.
EANUPCSupplement 0 EANUPCSupplement is the number of digits the UPC or EAN supplement will contain.
FixedResolutionCM 0 Sets the pixels per CM. This is useful when it is necessary to set the resolution of the output image. The default setting is "0" which is an automatic selection.
Font Arial 8 Points Used to change the font or font point size of the text interpretation or human readable text. In VB, this property may be changed in code, for example: BarCode1.Font.Size = 10  BarCode1.Font.Name = "Times New Roman"
ForeColor 0 The color of the foreground text and bars in the barcode specified by the Visual Basic Color Constant. The background color represented as an integer number from 0 (black) to 16777215 (white) obtained by combining the red, green, and blue values (each ranging from 0 to 255) to represent a color with the following formula: ((red * 1) + (green * 256) + (blue * 65,536)).
Black = 0.
LeftMarginCM 0.1 The space of the left margin in centimeters (CM).
NarrowBarWidth
or
NarrowBarCM
0.03 NarrowBarWidth is the width in centimeters of the narrow bars. This is also referred to as the X dimension. The default is 0.03 CM, which is about .012" or 12 mils. This value may need to be increased if the scanner being used cannot read barcodes with small X dimensions.
Orientation Zero degrees Orientation indicates the orientation of the barcode. Valid values are Zero degrees, 90 degrees, 180 degrees and 270 degrees.
Picture image Returns a WMF image without resolution information.
PostnetHeightShortBar 0.125 The size in centimeters of the short bars when using Planet and Postnet symbologies, and the tracker bar when using the Intelligent Mail (formerly OneCode).
PostnetHeightTallBar 0.30 The size in centimeters of the tall bars when using Intelligent Mail (formerly OneCode), Planet and Postnet symbologies.
ShowText Yes If ShowText is yes (the default), the human readable text will be displayed with the barcode.
SupplementToEncode null The 2 or 5 digit supplement to be encoded after the UPC or EAN barcodes. This property will populate automatically when the extra digits are added to the DataToEncode.
SymbologyID 13

A number that selects the symbology or barcode type:

0=Code 39
1=Code 39 ASCII
2=Interleaved 2 of 5
3=Code 11
4=Codabar
5=MSI
6=UPC-A
7=Industrial 2 of 5
8=Matrix 2 of 5
9=Code 93
10=EAN-13
11=EAN-8
12=UPC-E
13=Code-128
14=Planet
15=Postnet
16=UCC128
17=OneCode
TopMarginCM 0.06 The top margin in centimeters.
UPCESystem 0 The encoding system to be used for UPC-E; valid values are 0 and 1.
WhiteBarIncrease 0 A percentage value to increase the white space between the bars to improve readability. Common values are 10, 15, 20 and 25. *
Wide2NarrowRatio 2 The wide to narrow ratio of symbologies that only contain narrow and wide bars such as Code 39, Interleaved 2 of 5 and MSI. Common values are 2, 2.5, 2.75 and 3.
Methods
GetEnhWMF() Returns an enhanced WMF image with resolution information.
GetXPixels() GetXPixels returns the X dimension pixels of the image after it is created.
GetYPixels() GetYPixels returns the Y dimension pixels of the image after it is created.
SaveBarCode(path as String) SaveBarCode saves a WMF file without any resolution information.
SaveEnhWMF(path as String) SaveEnhWMF saves a WMF file with resolution information.
SetPixelsXY(XPixels as Long,YPixels as Long) SetPixelsXY sets the pixels of the WMF file.
Data Matrix Specific Properties:
IDAutomation recommends using default values for all properties, unless requirements dictate otherwise.
Name Default Description
EncodingMode E_BASE256 Valid Encoding Mode values are E_ASCII, E_C40, E_TEXT or E_BASE256.
MarginCM 0.10 The top and bottom margin in centimeters.
NarrowBarCM 0.05 The width in centimeters of the narrow bars; which is also referred to as the X dimension. The default is 0.05 CM which is about .02" or 20 mils. This value may need to be increased if the scanner cannot read barcodes with small X dimensions. When working with a high quality imager, this value may be decreased to obtain a higher density barcode.
PreferredFormat -1 Sets the preferred format represented by a number; valid values are from 0 (10X10) to 23 (144X144) and from 24 (8X18) to 29 (16X48); the default value of -1 is used for automatic formatting.
ProcessTilde No When set to "Yes", the tilde (~) will be processed as explained in the DataMatrix FAQ.
MaxiCode Specific Properties:
IDAutomation recommends using default values for all properties, unless requirements dictate otherwise.
Name Default Description
ApplyTilde 1 When set to "1," the format ~ddd may be used to specify the ASCII code of the character to be encoded as explained in the Maxicode FAQ. A setting of "0" will disable ApplyTilde.
Country na A 3 digit number representing the country code. Proper implementation for UPS and other transportation applications will automatically override this field.
Mode 2 The mode of compression and encoding used in the symbol. Modes 2 and 3 are designed for use in the transport industry. Mode 4 encodes up to 93 characters or 138 digits. Mode 5 encodes up to 77 characters and provides more error correction capabilities than mode 4. Mode 6 indicates that the symbol encodes a message used to program a reader system or scanner.
ServiceClass na A 3-digit number representing the service code. Proper implementation for UPS and other transportation applications will automatically override this field.
ZipCode na The postal code; mode 2 uses a 9 digit numeric postal code and mode 3 uses a 6 character alphanumeric postal code. Proper implementation for UPS and other transportation applications will automatically override this field.
PDF417 Specific Properties:
IDAutomation recommends using default values for all properties, unless requirements dictate otherwise.
Name Default Description
ErrorCorrectionLevel 2 The Reed Solomon error correction level encoded in the symbol. More error correction creates a larger symbol that can withstand more damage.
MacroPDFEnable 0 When set to "1," indicates that this barcode is part of a MacroPDF sequence.
MacroPDFFileID 0 Assigns a File ID to the MacroPDF barcode. Each barcode in the MacroPDF sequence must have the same File ID assigned to it. Valid options are 0-899.
MacroPDFSegmentIndex 0 The index number of each MacroPDF symbol must have a unique segment index, starting at zero and incrementing thereafter by one.
MacroPDFLastSegment 0 When set to "1," indicates that this is the final barcode in the MacroPDF sequence.
PDFColumns 5 The number of data columns in the PDF417 barcode. The default is 5 and the maximum is 30.
PDFMode Binary The mode of compaction used to encode data in the symbol. When set to "Text", a smaller symbol may be created. Text mode encodes all characters on the US keyboard plus returns and tabs. Binary mode encodes ASCII 1 to 254.
PDFRows 0 Sets the number of rows. It is recommended to leave this setting at 0, the default.
Truncated 0 A truncated PDF417 symbol is more area efficient than normal PDF417. When set to true, the right hand side of the PDF417 is removed or truncated.
XtoYRatio 3 The X multiple height of individual cells; default = 3, usually 2 to 4 times the NarrowBarCM (X).
Aztec Specific Properties:
IDAutomation recommends using default values for all properties, unless requirements dictate otherwise.
Name Default Description
ApplyTilde False When set to "True", the format ~d??? may be used to specify the ASCII code of the character to be encoded. Commonly used ASCII codes are ~d009 which is a tab function and ~d013 which is a return function.
MessageAppend na Specifies the message appended across multiple symbols. Only valid if NumberOfSymbols is greater than 1.
NumberOfSymbols 1 Invokes MessageAppend across # symbols
XDimensionCM 0.06 The width in centimeters of the narrow bars. This value may need to be increased if the scanner cannot read barcodes with small X dimensions. When working with a high quality imager, this value may be decreased to create a smaller symbol.

* When used with low-resolution devices such as the display screen, changes within the WhiteBarIncrease property value may not be visible in the barcode control itself. However, the change will usually be shown when printed, if a printer with 300 dpi or greater is used. In addition, when saving the barcode as an image, WhiteSpaceIncrease can usually be seen with the SaveBarCode property, but not with the SaveEnhWMF property due to SaveEnhWMF formatting the image to the screen resolution.

Developer Notes for Programmers

Distribution with an Application

The file(s) to distribute after installation reside in the "WinSys" directory and begin with "IDAutomation." When distributing the ActiveX Barcode Control, it is necessary to copy it to the "System" directory of the destination PC and then register the DLL. This process may be automated with installation utilities.

IDAutomation ActiveX Barcode Controls are packaged with the Setup Generator Pro application by Gentee. Within the Setup Generator Pro application, the "Register as OCX or DLL" option must be selected for each ActiveX DLL file that is to be registered. This is an easy-to-use, yet powerful application that does not have any runtime requirements. Other setup applications are also available that register DLLs such as CreateInstall and the Windows Installer.

Multi-Threading:

Many instances of the ActiveX object within the application may be created as needed. However, the DLL does not support multi-threading and will not run as a separate process.

Technical Support

Free product support may be obtained by reviewing the knowledgebase articles that are documented below and by searching the resolved public help desk issues. Priority phone, email and help desk support is also provided up to 30 days after purchase. Additional priority phone, email and help desk support may be obtained if the Priority Support and Upgrade Subscription is active.

Related Products and Information

 

 Product Quick Links: [Barcode Fonts | Font Tools | Components | Label Software | Scanners | Printers | RFID | Product Index]

© Copyright 2000-2009 IDAutomation.com, Inc., All Rights Reserved. Legal Notices

Over 70% of Fortune 100 companies use IDAutomation products to automate their businesses.