I am creating a C++ Project where I access some properties of PDF using iTextSharp, so I have created a Managed C++ Dll to get values from C# and pass it on to C++.
Now If I keep these two Dlls (iTextSharp and Managed C++ ) in the Executable folder, then everything works fine but if I keep these two Dlls in Custom Folder, then it doesn't. Here is my code.
LPCTSTR wrapperFullPath = "D://New Folder//PDFWrapper.dll";
LPCTSTR iTextFullPath = "D://New Folder//itextsharp.dll";
HMODULE wrapInst = LoadLibraryExA(wrapperFullPath , NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
HMODULE iTextInst = LoadLibraryExA(iTextFullPath , NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
if((wrapInst != NULL) && ((iTextInst != NULL)) {
... // Get PDF Property here - Line 1
}
Now if my iTextSharp Dll is executable folder, then it is OK otherwise it is crash in Line 1 . I tried setting the Environment Variable as well but that didn't helped.
-Pankaj