Hi,
OE10.1BSP03
Win7 64b
I need to pass a character variable to an external dll.
The external dll expects a filename that can be loaded. But the dll returns me the error 'File not found'. I've checked 100 times and the file exists. So I think there's something wrong with the character parameter. I think that the DLL receives something else. I use \\ instead of \ (C-convention etc) in the filename. Adding CDECL in the procedure makes the progress-session crash, so that didn't solve my problem.
In the help-files of the DLL I find that it expects L_TCHAR.
This means :
UNICODE types
L_TCHAR : Defined as either char or TCHAR. If FOR_UNICODE is defined, then L_TCHAR will be defined as TCHAR.
Please, can someone point me into the correct direction ?
Here's the codes :
DEF VAR L-char AS CHAR NO-UNDO.
/* initialize L-bitmaphandle, is all correct because I used it in a previous run */
L-char = STRING("c:\\Disctemp\\1.tiff").
RUN L_LoadBitmap(INPUT L-char, INPUT GET-POINTER-VALUE(L-bitmaphandle),
INPUT GET-SIZE(L-bitmaphandle), INPUT 0, INPUT 0, INPUT 0, INPUT 0, OUTPUT L-status).
PROCEDURE L_LoadBitmap EXTERNAL "C:\Project\Scan\OCRProgress\LTFILU.dll" PERSISTENT:
/*------------------------------------------------------------------------------
Purpose:
Parameters: <none>
Notes:
------------------------------------------------------------------------------*/
DEFINE INPUT PARAMETER P-file AS CHAR.
DEFINE INPUT PARAMETER P-bitmaphandle AS LONG.
DEFINE INPUT PARAMETER P-size AS LONG.
DEFINE INPUT PARAMETER P-bitsperpixel AS LONG.
DEFINE INPUT PARAMETER P-colororder AS LONG.
DEFINE INPUT PARAMETER P-loadoptions AS LONG.
DEFINE INPUT PARAMETER P-fileinfo AS LONG.
DEFINE RETURN PARAMETER P-status AS LONG.
END PROCEDURE.
Kind regards,
Bart Syryn
Out of curiosity I downloaded the v14 eval - it returns success and failure based on the file existing without any further adjustment.
The v17.5 eval (which is using unicode) is returning error code -10 (file not found) all the time.
According to the following:
http://digital.ni.com/public.nsf/websearch/DC5EF03F3EEDCB9886257060007E8275?OpenDocument
Windows requires UTF-16 on unicode inputs.
Adjusting the string you pass with CODEPAGE-CONVERT( "c:\temp\mychart.png", "utf-16" ) does return a different result (error -825 ERROR_PNG_FILTER_MISSING) and crashes my client.
When the file name is incorrect -10 is returned.
Hi Stefan,
Thanks for you help, but I still get error -10, file not found. Strange thing is, when I use a 'png'-file, it workes the second time I try to load the 'png'-file, not the first time. With a 'tiff'-file it's just not working. But this is a question I'll post to the Leadtools support.
Are you willing to share the code that you used to test it with Leadtools 17.5. You've got error -825, but that means you're missing a DLL. You'll need to add some DLL's to the directory. My problem is also that I don't know the size I have to set to a structure (in this case the bitmaphandle). With trial and error, I set the size to 176, but maybe that's the problem. How do you determine the size to set ?
Kind regards
Bart Syryn
I'm not trying to actually use leadtools and only verifying that the file is found. My 'code' which I'm running from 10.2B06 32-bit on Windows Vista x64. I added the win32 dll folder to my PATH environment variable (otherwise some other dependency fails). I was only interested in getting the file to be found.
DEF VAR l-bitmaphandle AS MEMPTR .
DEF VAR L-char AS CHAR NO-UNDO.
DEF VAR l-status AS INT.
SET-SIZE( l-bitmaphandle ) = 10000.
L-char = CODEPAGE-CONVERT( "c:\temp\mychart.png", "utf-16" ).
RUN L_LoadBitmap(
L-char,
GET-POINTER-VALUE(L-bitmaphandle),
GET-SIZE(L-bitmaphandle),
0,
0,
0,
0,
OUTPUT L-status
).
MESSAGE l-status VIEW-AS ALERT-BOX.
PROCEDURE L_LoadBitmap EXTERNAL "C:\LEADTOOLS 17.5\redist\CDLL\Win32\ltfilu.dll":
/*------------------------------------------------------------------------------
Purpose:
Parameters:
Notes:
------------------------------------------------------------------------------*/
DEFINE INPUT PARAMETER P-file AS CHAR.
DEFINE INPUT PARAMETER P-bitmaphandle AS LONG.
DEFINE INPUT PARAMETER P-size AS LONG.
DEFINE INPUT PARAMETER P-bitsperpixel AS LONG.
DEFINE INPUT PARAMETER P-colororder AS LONG.
DEFINE INPUT PARAMETER P-loadoptions AS LONG.
DEFINE INPUT PARAMETER P-fileinfo AS LONG.
DEFINE RETURN PARAMETER P-status AS LONG.
END PROCEDURE.