Teklynx Discover ActiveX Manual

DOC--OEM6--ActiveX--US--06/00
P
PP
Pr
rr
ro
oo
og
gg
gr
rr
ra
aa
am
mm
mm
mm
me
ee
er
rr
r’
’’’s
ss
s
G
GG
Gu
uu
ui
iiid
dd
de
ee
e

The information in this documentation is not contractual in
nature. It is subject to modification without notice.
The software described in this manual is supplied under a
user license. Its use, duplication, or reproduction on any
media whatsoever, except as provided for under the terms
of the license, is not authorized.
No part of the manual may be copied, reproduced or
transmitted by any means whatsoever (unless it is for the
purchaser’s personal use) without the written permission of
Teklynx International.
E2000 Teklynx International Co.
All rights reserved
Windowst
tt
tis a registered trademark of MicrosoftâCorpora-
tion.
IBM,PC,AT PS/2 are registered trademarks of International
Business Machines,Inc.

Table of Contents
About this manual vii........................................
Welcome! vii............................................
The Programmer’s Guide vii..........................
Typographical conventions viii.........................
Discover ActiveX Automation
foryourlabelingsoftware Chapter1-1......................
Introduction Chapter 1 - 1..........................................
What is an ActiveX object? Chapter 1 - 2............................
What is the type library? Chapter 1 - 3..............................
Mechanisms Chapter 1 - 4..........................................
Server Activation Chapter 1 - 4.....................................
Create Object function Chapter 1 - 4.............................
GetObject function Chapter 1 - 5................................
New
function Chapter 1 - 6...........................................
Server Deactivation Chapter 1 - 7...................................
Quit method Chapter 1 - 8......................................
Data Type Chapter 1 - 8............................................
Application Object Chapter 1 - 8.................................
Document Object Chapter 1 - 9..................................
Collection Object Chapter 1 - 9..................................
Event management Chapter 1 - 11...................................
Handling an Object’s Events Chapter 1 - 11.......................
Connecting a WithEvents variable to an object Chapter 1 - 13.....
Compatibility with the previous version Chapter 1 - 14...............
Particularity about access rights Chapter 1 - 14.......................
1

Programmer’s Guideii
Reference Guide Chapter 2 - 15.....................................
Hierarchy diagram Chapter 2 - 15....................................
Application Object Chapter 2 - 17....................................
Object Properties Chapter 2 - 18..................................
Object Methods Chapter 2 - 23...................................
PrinterSystem Object Chapter 2 - 26.................................
Object Methods Chapter 2 - 26...................................
Options Object Chapter 2 - 29........................................
Object Properties Chapter 2 - 29..................................
Dialogs Collection Chapter 2 - 34.....................................
Object Properties Chapter 2 - 34..................................
Object Methods Chapter 2 - 35...................................
Dialog Object Chapter 2 - 36.........................................
Object Properties Chapter 2 - 36..................................
Object
Methods Chapter 2 - 37..........................................
RecentFiles Collection Chapter 2 - 38.................................
Object Properties Chapter 2 - 38..................................
Object Methods Chapter 2 - 39...................................
RecentFile Object Chapter 2 - 41.....................................
Object Properties Chapter 2 - 41..................................
Object Methods Chapter 2 - 42...................................
Documents Collection Chapter 2 - 43.................................
Object Properties Chapter 2 - 43..................................
Object Methods Chapter 2 - 44...................................
Document Object Chapter 2 - 46.....................................
Object Properties Chapter 2 - 46..................................
Object Methods Chapter 2 - 50...................................
Database Object Chapter 2 - 54......................................
Object Properties Chapter 2 - 54..................................
Object Methods Chapter 2 - 56...................................
Printer Object Chapter 2 - 58.........................................
Object Methods Chapter 2 - 58...................................
Object Properties Chapter 2 - 60..................................
Format Object Chapter 2 - 63........................................
Object Properties Chapter 2 - 63..................................
Object Methods Chapter 2 - 67...................................
DocumentProperties Collection Chapter 2 - 68........................
Object Properties Chapter 2 - 68..................................
Object Methods Chapter 2 - 69...................................
DocumentProperty Object Chapter 2 - 70.............................
Object Properties Chapter 2 - 70..................................
DocObjects Collection Chapter 2 - 72.................................
Object Properties Chapter 2 - 72..................................
Object Methods Chapter 2 - 74...................................
2

iiiTable of Contents
DocObject Object Chapter 2 - 76.....................................
Object Properties Chapter 2 - 76..................................
Object Methods Chapter 2 - 79...................................
Images Collection Chapter 2 - 80.....................................
Object Properties Chapter 2 - 80..................................
Object Methods Chapter 2 - 80...................................
Image Object Chapter 2 - 82.........................................
Object Properties Chapter 2 - 82..................................
Barcodes Collection Chapter 2 - 84...................................
Object Properties Chapter 2 - 84..................................
Object Methods Chapter 2 - 85...................................
Barcode Object Chapter 2 - 86.......................................
Object Properties Chapter 2 - 86..................................
Code2D Object Chapter 2 - 93.......................................
Object Properties Chapter 2 - 93..................................
Object Methods Chapter 2 - 94...................................
Texts Collection Chapter 2 - 95.......................................
Object properties Chapter 2 - 95..................................
Object Methods Chapter 2 - 95...................................
Text Object Chapter 2 - 97...........................................
Object Properties Chapter 2 - 97..................................
Object Methods Chapter 2 - 99...................................
TextSelection Object Chapter 2 - 102..................................
Object Properties Chapter 2 - 102..................................
Object Methods Chapter 2 - 103...................................
OLEObjects Collection Chapter 2 - 104.................................
Object Properties Chapter 2 - 104..................................
Object Methods Chapter 2 - 104...................................
OLEObject Object Chapter 2 - 106.....................................
Object Properties Chapter 2 - 106..................................
Object Methods Chapter 2 - 106...................................
Shapes Collection Chapter 2 - 108.....................................
Object Properties Chapter 2 - 108..................................
Object Methods Chapter 2 - 109...................................
Shape Object Chapter 2 - 113.........................................
Object Properties Chapter 2 - 113..................................
Object Methods Chapter 2 - 113...................................
Variables Collection Chapter 2 - 114...................................
Object Properties Chapter 2 - 114..................................
Object Methods Chapter 2 - 116...................................
Variable Object Chapter 2 - 118.......................................
Object Porperties Chapter 2 - 118..................................
TableLoockups Collection Chapter 2 - 120..............................
Object Properties Chapter 2 - 120..................................
Object Methods Chapter 2 - 120...................................
TableLoockup Object Chapter 2 - 122..................................

Programmer’s Guideiv
Object Properties Chapter 2 - 122..................................
Object Methods Chapter 2 - 123...................................
Formulas Collection Chapter 2 - 125...................................
Object Properties Chapter 2 - 125..................................
Object Methods Chapter 2 - 125...................................
Formula Object Chapter 2 - 127.......................................
Object Properties Chapter 2 - 127..................................
Object Methods Chapter 2 - 128...................................
Dates Collection Chapter 2 - 129......................................
Object Properties Chapter 2 - 129..................................
Object Methods Chapter 2 - 129...................................
Date Object Chapter 2 - 131..........................................
Object Properties Chapter 2 - 131..................................
Counters Collection Chapter 2 - 133...................................
Object Properties Chapter 2 - 133..................................
Object Methods Chapter 2 - 133...................................
Counter Object Chapter 2 - 135.......................................
Object Properties Chapter 2 - 135..................................
FreeVariables Collection Chapter 2 - 139...............................
Object Properties Chapter 2 - 139..................................
Object Methods Chapter 2 - 140...................................
Free Object Chapter 2 - 141...........................................
Object Properties Chapter 2 - 141..................................
DatabaseVariables Collection Chapter 2 - 143..........................
Object Properties Chapter 2 - 143..................................
Object Methods Chapter 2 - 144...................................
FormVariables Collection Chapter 2 - 145..............................
Object Properties Chapter 2 - 145..................................
Object Methods Chapter 2 - 146...................................
Strings Collection Chapter 2 - 147.....................................
Object Properties Chapter 2 - 147..................................
Object Methods Chapter 2 - 147...................................
Document Events Chapter 2 - 149.....................................
Object Methods Chapter 2 - 149...................................
Application Events Chapter 2 - 151....................................
Object Methods Chapter 2 - 151...................................
Appendix Chapter 3 - 152.............................................
InformationonVisualC++DataType Chapter3-152.................
Index Chapitre 4 - 155.................................................
3
4

About this manual
Welcome!
Welcome to the number one Windows based label design and
printing software. It provides the simplest, yet highest
performance solution for your labeling requirements.
This version of this labeling software integrates the ActiveX
technology offering you the possibility toe easily create a
program to control your labeling software.
The purpose of this manual is to help you program your own
application to control your labeling software. All you should know
about using ActiveX with your labeling software is described in
this manual. However, to get more information about the
ActiveX technology, refer to the Microsoft reference manuals.
The Programmer’s Guide is divided into three parts:
SDiscover ActiveX for your labeling software:thispart
gives the bases for programming with ActiveX.
SReference Guide: this part gives all the object, method and
property definitions integrated by your labeling software.
SAppendix: this part gives you information on Visual C++
Data Type.
The
Programmer’s
Guide

viii Programmer’s Guide
This manual distinguishes different types of information by using
the following conventions:
Sterms taken from the interface itself, such as commands,
appear in bold;
Skeys appear in small caps, as in the following example:
”Press the SHIFT key”;
Snumbered lists mean there is a procedure to follow;
Swhen the conjunction ”or” appears next to a paragraph it
means there is another procedure available for performing a
given task;
SWhen a menu command contains submenus, the menu name
followed by the command to select appears in bold. Thus,
”Choose File Open” means choose the File menu, then the
Open command.
This symbol provides tips for optimizing certain tasks, speeding
up the execution of commands, etc.
This symbol highlights important information about a particular
function or procedure.
This symbol highlights an example or an exercise.
Typographical
conventions

Discover ActiveX
Automation for your
labeling software
Introduction
Using ActiveX Automation, you can control almost anything
you create with your labeling software — even your labeling
software itself.
The ActiveX technology lets you easily integrate your labeling
software as a printing module or a designer module in your own
organization.
ActiveX is object oriented and all of the ActiveX objects are
programmable from any languages such as Visual Basic. So the
user can control his labeling software using your own program.
Your labeling software becomes the server and your program is
the client application.
Through this manual, you will find examples and references
using Visual Basic 6.0.
1

Chapter 1 -- 2 Programmer’s Guide
What is an ActiveX object?
An ActiveX object is an instance of a class that exposes
properties, methods, and events to ActiveX clients. ActiveX
objects support the COM (Component Object Model) - Microsoft
technology. An ActiveX component is an application or library
that is able to create one or more ActiveX objects. In this case,
your labeling software exposes many objects that you can use to
create new applications and programming tools. Within your
labeling software, objects are organized hierarchically, with an
object named Application at the top of the hierarchy (see
Chapter 2 - 15: the hierarchy diagram).
Each ActiveX object has its own member function definition.
When the member functions are exposed, it makes the object
programmable by an ActiveX client. Three types of members can
be exposed for an object:
SMethods are actions that an object can perform. For exam-
ple, the Document object in your labeling software provides
aClose method that closes the current document.
SProperties are functions that access information about the
state of an object. The Application object’s Visible property
determines whether the labeling software is visible or not.
SEvents are actions recognized by an object, such as clicking
the mouse or pressing a key. You can write code to respond
to such actions. In Automation, an event is a method that is
called, rather than implemented, by an object (see also
Chapter 1 - 11).
Your labeling software often works with several instances of an
object which together make up a Collection object.For
example, since your labeling software is a multiple-document
interface (MDI), it might have multiple documents. To provide an
easy way to access and program the documents, your labeling
software exposes an object named Documents, which refers to
all of the already opened document objects. Documents is a
collection object.
A Collection object lets you work as a group with the objects it
manage (see Chapter 1 - 9).
All the methods, properties and events are defined in
Chapter 2 - 17: Reference Guide.

Chapter 1 -- 3
Discover ActiveX Automation for your labeling software
What is the type library?
The type library supplied by the labeling software is a file
(Lppx2.tlb) that describes the type of all the ActiveX objects.
The type library does not store objects, it stores type informa-
tion. By accessing the type library, your application can
determine the characteristics of an object, such as the interfaces
supported by the object and the names and parameters.
This library helps you to write your program because it contains
all the definitions of object methods and properties that you can
access. Using this library you optimize your job.
ThenameofthistypelibraryisLabelManager2 with the
TK Labeling ActiveX 6.0 reference.
The procedures below show how to install and use the type
library with Visual Basic 6.0.
"
""
"To install the type library
1Choose Project References.
2Activate TK Labeling ActiveX 6.0 in the list of available ref-
erences then validate the dialog box.
"
""
"To display the methods and properties
1Use the Object Explorer by pressing the F2 key.
2In the library list, select LabelManager2.
"
""
"To use the type library
SWhile writing code, you have just to enter a period ”.” after
an object to get the associated methods and properties, or
after a method to get the associated properties.

Chapter 1 -- 4 Programmer’s Guide
Mechanisms
Your labeling software offers you two main objects: the
Application object that is at the top of the hierarchy and the
Document object. These main objects provide access to the
subordinated objects (see Chapter 2 - 15: the hierarchy
diagram).
The first step to activate the server is the main object creation,
in this case, the Application object.
The last step is the deactivation of the server with the Quit
method.
Server Activation
SeveralmethodsareavailabletocreateanActiveXobject.
This function creates and returns a reference to the Application
object.
Syntax CreateObject(server name)
Defines an object variable. This object variable is meant to con-
tain the object reference. Dim as Object creates a link at exe-
cution.
Dim MyApp as Object
Set MyApp = CreateObject(”Lppx2.Application”)
This code launches the application that creates the object. In this
case, the labeling software. As soon as the object is created, you
reference it in the code with the object variable that you have
defined, i.e. MyApp.
Note If you define an object variable with “As Object”, a variable
containing a reference for any object type is created. However,
the access to an object via this variable is realized by a late
bind, i.e. the link is created during the execution of your pro-
gram. To create an object variable that induces an early bind,
i.e. a link during the compilation of your program, define the
object variable with a specific identifier (see below).
Create Object
function

Chapter 1 -- 5
Discover ActiveX Automation for your labeling software
For example, you can define and create the reference using the
code below:
Dim MyApp As Lppx2.Application
Set MyApp = CreateObject(”Lppx2.Application”)
The variable reference creating an early bind increases the
performance but must only contain one reference.
This function returns a reference to an ActiveX object from a file.
Syntax GetObject([pathname],[server name])
The syntax of the GetObject function includes the following
arguments:
Item Description
pathname Optional. Variable of Variant
type (String). Complete path-
name with the name of the
file containing the object to
get. If you don’t define the
pathname, you have to define
the server name.
servername Optional. Variable of Variant
type (String). Name of the
application that gives the
object.
Note Use the GetObject function to access an ActiveX object from a
file and to assign this object, an object variable. Use the Set
instruction to assign the object that is returned by the GetOb-
ject functionattheobjectvariable(seebelow).
Below are several examples showing the variations of the
GetObject syntax.
Dim MyDoc As Object
Set MyDoc = GetObject(”c:\ProgramFile\document.lab”)
When this code is executed, the application associated with the
pathname argument is launched and the object included in the
file is activated.
Note In the case where the server automation is already loaded in
the system memory, the ActiveX mechanism selects it, then the
document is activated.
GetObject
function

Chapter 1 -- 6 Programmer’s Guide
Intheexamplebelow,theservernameisspecified.Usethis
parameter if you have several versions of your labeling software
to open the document.lab with the correct version.
Dim MyApp As Object
Set MyApp = GetObject (”c:\ProgramFile\docu-
ment.lab”,”Lppx2.Application”)
Note that in the example below the Visual Basic for Application
expression GetObject(,”Lppx2.Application) will fail unless the
Application (the labeling software) is already running. If the
Application is not already running, a new instance will not be
launched.
Dim MyApp As Object
Set MyApp = GetObject (,”Lppx2.Application”)
In this example, the variation of the GetObject syntax varies
from the previous example in that a new instance of the applica-
tion will always be launched even if the application is already
running. This variation is equivalent to a CreateObject state-
ment.
Dim MyApp As Object
Set MyApp = GetObject (””,”Lppx2.Application”)
The key word New can only be used if you work with the Type
Library (see: What is the type library).
New assigns an object reference to a variable or to a property.
Syntax
SetMyApp={[New]objectexpression}
This example demonstrates reation of the MyApp object that
represents Application. This is the standard access to get the
subordinated objects of Application.
Dim MyApp As LabelManager2.Application
Set MyApp = New LabelManager2.Application
New
function

Chapter 1 -- 7
Discover ActiveX Automation for your labeling software
The syntax of the Set instruction contains the following items:
Item Description
objectvar Nameofthevariableorprop-
erty.
New Optional. This key word is
generally used in the declara-
tions to allow the implicit cre-
ationofanobject.Usedwith
Set, the New key word
creates a new instance of the
class. If the objectvar argu-
ment contains a reference to
an object, this reference is
lost when a new association is
created.
Note The objectvar must have an object type compatible with the
object to which it is assigned.
Server Deactivation
The last step of your program is the deactivation of the server
with the Quit method.
To correctly deactivate the server, you must:
a. Close all the documents with the CloseAll method on the
Documents collection.
b. Call the Quit method of the Application object. This method
meanstheprocessisended.
c. Ask Visual Basic to delete the Application from the system
memory by setting the value of the variable to Nothing.

Chapter 1 -- 8 Programmer’s Guide
The Quit method is used to end the process. Before using this
method, you must close all the documents.
Thefollowingexampleshowshowtodeactivatetheserver.Use
the CloseAll method on the Documents collection to close all
the documents. Then, use the Quit method on the Application
object to end the process. At the end, the Set instruction delete
the Application from the system memory.
MyApp.Documents.CloseAll False
MyApp.Quit
Set MyApp = Nothing
Data Type
There are three data types corresponding to the three main
objects: Application,Document and Collection.
The Application object represents the labeling software. The
Application object contains the properties and the methods that
return the first level objects. For example, the ActiveDocument
property returns a Document object.
"
""
"Using the Application object
To return the Application object, use the Application property.
The following sample shows how to display the path defined for
the labeling software.
Dim MyApp As LabelManager2.Application
Set MyApp = New LabelManager2.Application
MsgBox MyApp.Path
Most of the properties and methods that return the common user
interface objects, such as the active document (ActiveDocu-
ment property), can be used without the identifier of the
Application object by using the With keyword.
Quit method
Application
Object

Chapter 1 -- 9
Discover ActiveX Automation for your labeling software
Dim MyApp As LabelManager2.Application
...
With MyApp
.ActiveDocument
.Print
end With
The properties and methods that can be used without the
Application object are called “global.”
STo display the global properties and methods in the object
explorer (F2 key), click on global at the beginning of the list
displayed in the Classes zone.
The Document object represents an open document. Each open
document in the labeling software is represented by a Docu-
ment object. This object has members (properties, methods,
and events) that you can use to manipulate the document.
You can access the current document if there is an open
document by using the ActiveDocument property of the
Application object.
All open documents that belong to the documents collection are
represented by the Documents object. You can find a particular
document by moving through this collection.
ACollection object is an ordered set of items that can be
referred to a unit.
Note The Collection object provides a convenient way to refer to a
related group of items as a single object. The items, or mem-
bers, in a collection need only be related by the fact that they
exist in the collection. Members or items of a collection don’t
have to share the same data type (see Chapter 1 - 8).
A collection can be created the same way other objects are
created. For example:
Dim X As New Collection
Once a collection is created, members can be added using the
Add method and removed using the Remove method. Specific
members can be returned from the collection using the Item
method, while the entire collection can be returned using the For
Each...Next statement.
Document
Object
Collection
Object

Chapter 1 -- 10 Programmer’s Guide
"
""
"Collection methods
Methods for collection are described in the following table. The
Item method is required; other methods are optional.
Method name Return type Description
Add VT_DISPATCH
or VT_EMPTY
Adds an item to a collec-
tion. Returns VT_DISPATCH
if object is created (object
cannot exist outside the
collection) or VT_EMPTY if
no object is created (object
can exist outside the collec-
tion).
Item Varies with
type of collec-
tion
Returns the indicated item
in the collection. Required.
The Item method may
take one or more argu-
ments to indicate the ele-
ment within the collection
to return. This method is
the default member for the
collection object.
Remove VT_EMPTY Removesanitemfroma
collection. Uses indexing
arguments in the same way
as the Item method.
The Item method takes one or more arguments to indicate the
index. Indexes can be numbers or strings.
Because Item is the default method, you could write either:
MyObject.Item(3).Name
-Or-
MyObject(3).Name
"
""
"Count Property
Returns a Long (long integer) containing the number of objects
in a collection. Read-only.

Chapter 1 -- 11
Discover ActiveX Automation for your labeling software
Event management
When a program detects that something has happened, it can
notify its clients. For example, if a stock ticker program detects a
change in the price of a stock, it can notify all clients of the
change. This notification process is referred to as firing an event.
Client
Server: Lppx2
Application
Document
Events
Get or set properties.
Call methods.
Fire events
(event source)
Figure 1 Interaction between the Client and
the Labeling software
An object that triggers events is called an event source.To
handle the events triggered by an event source, you can declare
a variable of the object’s class using the WithEvents keyword.
For example, to handle the ProgressPrinting event of a Docu-
ment, place the following code in the Declarations section:
Option Explicit
Private WithEvents MyDoc As LabelManager2.Document
Private mblnCancel As Boolean
In this case, the client application must set the EnableEvents
property of the application to True in order to trigger the events.
The WithEvents keyword specifies that the variable MyDoc will
be used to handle an object’s events. You specify the kind of
object by supplying the name of the class from which the object
will be created.
The variable MyDoc is declared in the Declarations section
because WithEvents variables must be module-level variables.
Thisistrueregardlessofthetypeofmoduleyouplacethemin.
The variable mblnCancel will be used to cancel the LongTask
method.
"
""
"Limitations on WithEvents variables
You should be aware of the following limitations on the use of
WithEvents variables:
Handling an
Object’s
Events

Chapter 1 -- 12 Programmer’s Guide
SAWithEvents variable cannot be a generic object variable.
Thatis,youcannotdeclareitAsObject-youmustspecify
the class name when you declare the variable.
SYou cannot declare a WithEvents variable As New. The
event source object must be explicitly created and assigned
to the WithEvents variable.
SYou cannot declare WithEvents variables in a standard mod-
ule. You can declare them only in class modules, form mod-
ules, and other modules that define classes.
SYou cannot create arrays of WithEvents variables.
"
""
"Writing code to handle an event
As soon as you declare a variable WithEvents,thevariable
name appears in the left-hand drop down of the module’s code
window. When you select MyDoc,theDocument class events
will appear in the right-hand drop down, as shown in Figure 2
below:
Figure 2 An event associated with a WithEvents variable
Selecting an event will display the corresponding event
procedure, with the prefix MyDoc_. All the event procedures
associated with a WithEvents variable will have the variable
name as a prefix.
Table of contents
Other Teklynx Software manuals
Popular Software manuals by other brands

Ulead
Ulead MEDIASTUDIO PRO 6.0 user guide

ScanSoft
ScanSoft PDF CONVERTER 2 FOR MICROSOFT WORD Quick reference guide

Canon
Canon EOS Digital Photo Professional instruction manual

Oracle
Oracle Retail Data Warehouse installation guide

National Instruments
National Instruments NI Spectral Measurements Toolkit user guide

Speco
Speco Speco-NVR user guide