The filename or extension is too long

Error message "System.Runtime.InteropServices.COMException (0x80004005): Cannot load DLL C:\Program Files\ABBYY SDK\Bin\Protection.dll." appears.

 The error is specific for FineReader Engine if the Engine object is loaded by means of COM into the current process. 

The reason why it happens is that there are too many files in the %TEMP% folder.

Please ensure that you call the method

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

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.

If you don't load Engine out-of-process, then 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 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). If that is not possible, then swich to other ways of loading Engine ( "Guided Tour" → "Advanced Techniques" → "Programming Aspects" → "Different Ways to Load the Engine Object")

Was this article helpful?

0 out of 5 found this helpful

Have more questions? Submit a request



Please sign in to leave a comment.

Recently viewed