Page 1 of 1

Didn't found OCR-Dll

Posted: Thu Sep 24, 2009 1:13 pm
by iirusger
I have a project of an AddOn for a main application, wich call a .Net-Dll with the GdPicture functions twain-scan, display and maniplulate a picture
and give it back to the main application as searchable Pdf. So OCR is needet.

Call GdPicture and all his functions is possible under XP , somtimes unter Vista and never under Windows7,
there an error was displayed as statusreturncode: didn't found the GdPicture.NET.ocr.tesseract.dll.

I know, if it lie in the main application directory or unter windows or windows\system32 it would be found.
But for me it is forbidden to save it at this places.

I have to save it in my AddOn directory.
This Dll is placed there together with the other GdPicture-Dlls and the GdPicture.Net.Dll (version 6.4) is registered there.

How find the GdPicture-Dll itself the OCR-Dll?
Is there a variable wich can be read/write for the place of the DLL?
If there a way to say my application where the OCR-Dll is? Unfortunately I don't call it myself.

I need this informations to create a setup for my AddOn.

Re: Didn't found OCR-Dll

Posted: Thu Sep 24, 2009 4:38 pm
by Loïc
Hi,

The dll must be placed into the same directory of your application or within a directory defined into the "PATH" environment variable.

With best regards,

Loïc

Re: Didn't found OCR-Dll

Posted: Wed Oct 21, 2009 1:39 pm
by iirusger
Loïc wrote:...The dll must be placed into the same directory of your application or within a directory defined into the "PATH" environment variable...
For me it is forbidden to write values in the central windows system and to place my DLL in the application path too. :twisted:

Because i found an other way to say at the runtime where my DLL is locateted in an external but shared DLL-Path: :D
in C# I wrote:
// remember where my registered DLL is wich i even started
private string _assemblyDir = new System.IO.FileInfo(System.Reflection.Assembly.GetExecutingAssembly().Location).DirectoryName.ToString();
// call the Kernel32.dll to use the SetDllDirectory command
[DllImport("Kernel32",CharSet=CharSet.Unicode)]
public extern static bool SetDllDirectory(string _assemblyDir);
// set the searchpath and get the returncode = true if all done right
bool returncode = SetDllDirectory(_assemblyDir);

however, it works. For more information you can read at http://msdn.microsoft.com/en-us/library ... 85%29.aspx

:oops: Loïc, you are right,
:lol: there are more Path variables than for system and user ! I learned it now. :lol:
the unknown before for me is this for the application envirement.
so I wrote a other code for various places of DLLs to find all:
in C# I wrote:
// remember where my registered DLL is, wich i even started
private string _assemblyDir = new System.IO.FileInfo(System.Reflection.Assembly.GetExecutingAssembly().Location).DirectoryName.ToString();
// read the old content
string ePath = Environment.GetEnvironmentVariable("Path");
// check if the needed path already in the content
if (ePath.IndexOf(_assemblyDir)==-1) {
// add the Path to the content if not already in it
Environment.SetEnvironmentVariable("Path", ePath + ";" + _assemblyDir); }

regards iirusger

Re: Didn't found OCR-Dll

Posted: Wed Oct 21, 2009 2:08 pm
by Loïc
Thank you so much for this update.

Your information will be at least, very useful for my developments :wink:

Loïc