Skip to main content
Some of the objects in ABBYY FineReader Engine are so-called “connectable objects.” This means that they implement the IConnectionPointContainer interface. Connectable objects support communication between ABBYY FineReader Engine and its clients.
In Linux, the Engine object loaded as an out-of-process server does not support working with callbacks.
For Windows users, each of the FRE connectable objects provides connection points of two types — one that uses a dispatch interface and one that uses the interface derived from IUnknown. The dispatch interface is designed for automatic use in Visual Basic and similar environments, while the vtbl-based interface is suitable for use in C++.
In the table below, you can find the list of connectable objects in ABBYY FineReader Engine and corresponding callback interfaces (dispinterfaces):
Dispinterfaces are Windows-specific.
Windows Visual Components ABBYY FineReader Engine client application that wants to receive notifications of certain events in ABBYY FineReader Engine should implement interfaces of a specific type and “advise” the objects implementing these interfaces to the corresponding connectable objects.
There are two global methods used for connecting and disconnecting to the notification source:
These methods should receive one of the connectable objects as the object argument and the corresponding callback interface as the callback argument.You need to implement the necessary interface and “advise” object implementing the interface to the corresponding connectable objects. We will use the FRDocument object as an example.
  1. Implement the IFRDocumentEvents interface. As it is derived from the IUnknown interface, the client object should also implement the IUnknown methods:
  2. Then the CFRDocumentCallback class can be used to receive notifications from the FRDocument object. Advise this object to the notifications source (error handling is omitted):
Linux users can also refer to the EventsHandling sample.
The remainder of this topic applies to users of FRE for Windows.
For Windows:
Simply declare the connectable object WithEvents and implement the methods of the corresponding callback interface. You will also need to explicitly specify the event handler associated with the event.For the FRDocument object, the procedure will be the following:
  1. Declare the FRDocument object WithEvents:
  1. Implement the necessary methods of the DIFRDocumentEvents dispinterface in the Sub similar to the following.
If you want to start and stop event handling at any time during program execution (using AddHandler and RemoveHandler statements):or simply specify that this procedure handles a particular event (use the Handles keyword when defining):
  1. Connect the implemented event handler to the event source, use the FRDocument object for processing, then disconnect the handler:
In C++, you need to implement the necessary interface, obtain a connection point, and “advise” object implementing the interface to the corresponding connectable objects. We will use the FRDocument object as an example.
  1. Implement the IFRDocumentEvents interface. As it is derived from the IUnknown interface, the client object should also implement the IUnknown methods:
  1. Then the CFRDocumentEventsListener class can be used to receive notifications from the FRDocument object. Advise this object to the notifications source (error handling is omitted):
C# procedure is similar to that of Visual Basic .NET. You need to implement the necessary methods of the callback interface and connect the implemented event handlers to the event source. We will use the FRDocument object as an example.
  1. Implement the necessary methods of the IFRDocumentEvents interface:
  1. Connect the event handler to the event source, use the FRDocument object for processing, then disconnect the handler:
Windows users should refer to documentation on COM for a more detailed description of connectable objects. You can also refer to the EventsHandling sample provided in FRE for Linux for C++ and Windows for C#, C++ with the Native COM Support, raw C++, Visual Basic .NET.