Early and late binding, Early binding, Late binding – Kofax DM API User Manual

Page 51: Early binding 31

Advertising
background image

A

N

O

VERVIEW

OF

THE

DM API 31

Early and Late Binding

PCDSQL

PCDTrusteeList

Early and Late Binding

You can create objects in the DM API using either early binding or late
binding. Examples shown in this document will sometimes use early
binding, and other times will use late binding. In custom applications
you implement, you can usually use either, but there are a few instances
where the text will indicate that one should be used in preference to the
other.

Early Binding

With early binding you create an object in a single step when you first
dimension it. This may be the most appropriate way to create an object
if you are going to use it immediately.

Early binding uses the New keyword within the Dim statement when
the object is first dimensioned. For example:

Dim pDoc As New PCDClient.PCDPutDoc

The

New

operator must be used on Visual Basic objects that have

Private

or

PublicNotCreatable

instancing properties.

Late Binding

With late binding you first dimension the item you want to create, often
dimensioning it as a generic object. Later, when you are ready to use the
object, you use the

Set

statement to instantiate the object in memory.

For example:

Dim pObj As Object

...

Set pObj = CreateObject(“PCDClient.PCDLookup”)

If your application uses the Microsoft Transaction Server, you must
create objects using late binding with the

CreateObject

method. The

Transaction Server cannot see instances of externally created objects
that you generate with the

New

operator.

Advertising