Skip to main content
The interfaces of ABBYY FlexiCapture SDK objects have various properties and methods. As Visual Basic users are familiar with the notion of property, we will discuss the way the properties are handled in C++. For a C++ user, a property is a couple of methods (get and put for read-write properties) or a single get method (for read-only properties). However, the “Native COM support” featured by Microsoft Visual C++ makes the way the properties are handled more like the one used in Visual Basic. This is the way implied by the sense on the noun “property.” The ABBYY FlexiCapture SDK properties may be of the following types: See the details of working with different types of properties below:
We will use the Boolean property to describe how simple properties are used. This property is described in the type library as follows:
A Visual Basic user handles this property as follows:
A C++ user, on the other hand, uses two methods to work with this property. These methods have get_ and put_ prefixes. The respective C++ code should look as follows:
However, the Native COM support makes the procedure simpler, and the respective code should look like this:
If the type library only defines the “get” method for a property, this property is called read-only. Its value cannot be changed by the user, it may only be accessed for “reading.”
Working with string properties is very similar to working with simple properties, but has its own specifics. A C++ user working with string properties must free the strings that are passed to set-methods, and also those that are returned by get-methods. However, this is done automatically in Visual Basic and in C++ with the Native COM support. Suppose MyObject also supports a string property called Name. This property is described in the type library as follows:
A C++ user works with this property like this:
For Visual Basic this may be rewritten:
A C++ user will say that the parameters of “get” methods of “Object” properties are pointers to an object’s interface pointer. As the interfaces of the objects are derived from IUnknown, they may be passed as IUnknown pointers to the properties or methods, which use objects of several types as input or output parameters (you may, however, get the interface you need by calling the QueryInterface method).There are two different types of “put” methods for object properties — clear put, described by the propput keyword in the type library (the object is copied in this case); and put by reference, described by the propputref keyword in the type library (only a pointer to an existing object’s interface is stored in the property in this case). A property may support only one of these put methods; most of ABBYY FlexiCapture SDK object properties clear put. In Visual Basic put by reference is performed using the Set statement, while clear put is performed without this keyword.Suppose again the MyObject object supports MyObjectProperty property that refers to an object of MyChildObject type.
The same property is accessed as follows in Visual Basic:
A C++ user will write this code as follows:
Note that in C++ you should call the Release method for an object got via a property. The Native COM support calls AddRef and Release methods automatically using auto pointers.
If an object property refers to a child object of the object that exposes this property, a pointer to the child object’s interface is valid until its parent object exists. An attempt to access a child object after its parent object is destroyed may result in an error.

Working with read-only object properties

Certain ABBYY FlexiCapture SDK objects have read-only object properties. This does not mean that such properties cannot be changed, this only means that they cannot be changed directly. In raw C++, if you want to change such a property, you need to pass a reference to the property object to a new variable, and then use this variable to change it. Below you can see a C++ sample for the IProject::Batches property which is represented by a read-only collection:

See also

Types of ABBYY FlexiCapture SDK Properties