OCR SDK Knowledge Base

Article ID: 457 | Category: Engine Initialization | Type: Hot Fix | Last Modified: 9/17/2015

The filename or extension is too long


Why do I receive "System.Runtime.InteropServices.COMException (0x80004005): Cannot load DLL C:\Program Files (x86)\ABBYY SDK\Bin\Protection.dll. The filename or extension is too long." message?


There are too many files in the %TEMP% folder.


Please note that you should call

SetEnvironmentVariableA("PATH", System.Environment.GetEnvironmentVariable("PATH") + ";" + dllFolder);

method only once for your application. If you load and unload Engine several times within single run of your application, therefore please call the SetEnvironmentVariableA() method only once for the first loading of Engine object.

Cleaning %TEMP% folder may help to resolve this issue.

Work with Engine is performed within MTA-thread. Please note that all work with Engine should be done (initialized, used, deinitialized) within single STA-thread; otherwise correct work of Engine is not guaranteed and various unexpected errors may occur. In FineReader Engine 10 Help please check the article Guided Tour > Advanced Techniques > Programming Aspects. In case you create some special thread for OCR in your application, before running such thread you should set its apartment state to STA (Thread.SetApartmentState() method).

311 people think this is helpful.
Was this information helpful to you?