Skip to main content
The interfaces of ABBYY FineReader Engine objects have various properties and methods. In general, properties represent information about an object, whereas methods represent actions an object can take.
C# samples apply to Windows. C++ samples apply to all supported operating systems.
For C++, a property is a pair of methods (get and put for read-write properties) or a single get method (for read-only properties).The ABBYY FineReader Engine properties may be of the following types:
  • VARIANT_BOOL (with two values VARIANT_TRUE or VARIANT_FALSE)
  • int
  • double
  • BSTR, a pointer to Unicode string. Zero value specifies an empty string.
  • __int64
  • HANDLE*
  • IUnknown-derived interface
  • enum
C# and Visual Basic users are familiar with the notion of property.For a C++ user, a property is a pair 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 C++ makes the way the properties are handled more like the one used in C#.The ABBYY FineReader Engine properties may be of the following types:
See the details of working with different types of properties below:
We will use a Boolean property as an example of how simple properties are used. The property is described in the type library as follows:
If the type library only defines the “get” method for a simple property, this property is called read-only. Its value cannot be changed by the user, it may only be accessed for “reading.”A C# user handles a simple 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 in Windows makes the procedure simpler, and the respective code should look as follows:
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.
  • In Windows, this is done automatically in C#, Visual Basic, and in C++ with the Native COM support.
  • In Linux, use the FREngineAllocString and FREngineFreeString functions to allocate and free the memory for the strings.
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:Windows
Linux
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).A “put” method for an object property, if any, supports clear put, described by the propput keyword in the type library. This means that the object is copied (instead of passing a pointer to an existing object’s interface).Suppose again the MyObject object supports MyObjectProperty property that refers to an object of MyChildObject type.
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. Native COM support in Windows calls AddRef and Release methods automatically using auto pointers.

Working with read-only object properties

Certain ABBYY FineReader Engine objects (for example, ILayout::Blocks) have read-only object properties. This does not mean that such properties cannot be changed, this only means that they cannot be changed by directly replacing the object property with another object, because “put” method is not supported. However, you can change the sub-properties of these objects. In C++ (raw C++ if Windows), 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 ILayout::Blocks property which is represented by a read-only collection: