Creating the Object Pascal Wrapper Unit
In order to use ABBYY FlexiCapture 12 SDK in Delphi, it is necessary to create the Object Pascal wrapper unit for the type library (the FCEngine_TLB.pas file). To generate the wrapper:- Run command prompt (cmd.exe) and go to the folder where the ABBYY FlexiCapture 12 SDK type library (FCEngine.tlb) is located.
-
Run the tlibimp utility with the following parameters:
- Add FCEngine_TLB.pas to your project.
Using Engine loaders in Delphi 7
There is also an alternative way of using ABBYY FlexiCapture SDK in Delphi 7, for which you will not need to create the wrapper manually as described above. But this method is only suitable if you load the Engine object in your application using the Engine loaders.- Open your project and choose Project > Import Type Library.
-
In the dialog that opens choose ABBYY FlexiCapture 12 SDK Type Library in the list. Make sure that Generate Component Wrapper flag is turned on. Click Install.
An error at this stage may indicate that the system environment variable Path does not contain the necessary paths. Modify it to include the path to the mscoree.tlb file (generally it is C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727).
- New components appear on the ActiveX tab of the Components palette — InprocLoader and OutprocLoader. You can add one of these components directly onto your form and use it to load the Engine object.
Deinitialization of the Engine Object
If not all the objects which were created and used by the application have been deleted before the Engine object deinitialization, the “Engine deinitialization failed” exception is thrown. If all the objects have been deleted, the exception may be caused by the scavenger operation. In Delphi all objects with the nil value are deleted only after the exit from the procedure in which the objects were declared. Therefore, the entire ABBYY FlexiCapture SDK code must be inserted into a separate procedure, and this procedure must be called before the Engine object deinitialization.You can use the StartLogging method of the Engine object to get the list of objects that have not been deleted.
