The TOCRdll.dll that you posted here:
http://lac.structuredsystems.com/temp/
is loading fine
Invalid licence number Software\Transym\TOCR\1.1\Paths Failed to find Paths
JobInfo2.InputFile = InputFile;
JobInfo2.InputFile = ( char * ) InputFile;
TOCRRESULTS *Results = 0;
TOCRRESULTSEX *Results = 0;
xHarbour Compiler build 1.2.1 (SimpLex) (Rev. 6741)
Copyright 1999-2010, http://www.xharbour.org http://www.harbour-project.org/
Compiling 'transym.prg' and generating preprocessed output to 'transym.ppo'...
100
Lines 15, Functions/Procedures 1
Generating C source output to 'transym.c'...
Done.
Borland C++ 5.82 for Win32 Copyright (c) 1993, 2005 Borland
transym.c:
Turbo Incremental Link 5.69 Copyright (c) 1997-2005 Borland
Error: Unresolved external 'TOCRSetConfig' referenced from F:\FWH_2012_04\SAMPLES\TRANSYM.OBJ
Error: Unresolved external 'TOCRInitialise' referenced from F:\FWH_2012_04\SAMPLES\TRANSYM.OBJ
Error: Unresolved external 'TOCRShutdown' referenced from F:\FWH_2012_04\SAMPLES\TRANSYM.OBJ
Error: Unresolved external 'TOCRDoJob2' referenced from F:\FWH_2012_04\SAMPLES\TRANSYM.OBJ
Error: Unresolved external 'TOCRWaitForJob' referenced from F:\FWH_2012_04\SAMPLES\TRANSYM.OBJ
Error: Unresolved external 'TOCRGetConfig' referenced from F:\FWH_2012_04\SAMPLES\TRANSYM.OBJ
Error: Unresolved external 'TOCRGetJobStatusMsg' referenced from F:\FWH_2012_04\SAMPLES\TRANSYM.OBJ
Error: Unresolved external 'TOCRGetJobResultsEx' referenced from F:\FWH_2012_04\SAMPLES\TRANSYM.OBJ
* Linking errors *
#define TOCRJOBTYPE_TIFFFILE 0 // TOCRJOBINFO.InputFile specifies a tiff file
FUNCTION MAIN()
LOCAL TestTifFile := "sample.tif"
IF !FILE( TestTifFile )
Alert( "testfile sample.tif not found" )
return NIL
ENDIF
MsgInfo( OCRFromFileUsingTransym( TestTifFile, TOCRJOBTYPE_TIFFFILE ) )
RETURN NIL
//-----------------------------------------------------------
#pragma BEGINDUMP
#include <hbapi.h>
#include <windows.h>
#include "TOCRdll.h"
#include "TOCRuser.h"
#include "TOCRerrs.h"
BOOL OCRWait( long JobNo, TOCRJOBINFO2 JobInfo2 );
BOOL GetResults( long JobNo, TOCRRESULTSEX ** Results );
BOOL FormatResults( TOCRRESULTSEX * Results, char * Msg );
//--------------------------------------------------------
//parameters
// 1. input file with image
// 2. type of file to ocr //should default to TIFF
//returns OCRed text
HB_FUNC( OCRFROMFILEUSINGTRANSYM )
{
TOCRJOBINFO2 JobInfo2;
TOCRRESULTSEX * Results = 0;
long Status;
long JobNo;
char Msg[8192];
char * InputFile = ( char * ) hb_parcx( 1 ); //parm 1 is input file
//Sets Transym to print error to log file tocr.log
TOCRSetConfig( TOCRCONFIG_DEFAULTJOB, TOCRCONFIG_DLL_ERRORMODE, TOCRERRORMODE_MSGBOX );
memset( &JobInfo2, 0, sizeof( TOCRJOBINFO2 ) );
JobInfo2.JobType = hb_parni( 2 ) ; //TOCRJOBTYPE_TIFFFILE;
JobInfo2.InputFile = InputFile;
Status = TOCRInitialise( &JobNo );
if ( Status == TOCR_OK ) {
if ( OCRWait( JobNo, JobInfo2 ) ) {
if ( GetResults( JobNo, &Results ) ) {
FormatResults( Results, Msg );
hb_xfree( Results ); //free( Results );
}
}
TOCRShutdown( JobNo );
}
hb_retc( Msg ) ;
}
//--------------------------------------------------------
BOOL OCRWait( long JobNo, TOCRJOBINFO2 JobInfo2 )
{
long Status;
long JobStatus;
long ErrorMode;
char Msg[4096];
Status = TOCRDoJob2( JobNo, &JobInfo2 );
if (Status == TOCR_OK) {
Status = TOCRWaitForJob(JobNo, &JobStatus);
}
if (Status == TOCR_OK && JobStatus == TOCRJOBSTATUS_DONE)
{
return TRUE;
} else {
// If something hass gone wrong display a message
// (Check that the OCR engine hasn't already displayed a message)
TOCRGetConfig(JobNo, TOCRCONFIG_DLL_ERRORMODE, &ErrorMode);
if ( ErrorMode == TOCRERRORMODE_NONE ) {
TOCRGetJobStatusMsg(JobNo, Msg);
//MessageBox( NULL, Msg, "OCRWait", MB_TASKMODAL | MB_TOPMOST | MB_ICONSTOP );
}
return FALSE;
}
} // OCRWait()
//--------------------------------------------------------
// Get the results from TOCR
BOOL getresults(long JobNo, long mode, void **Results)
{
long Status;
long ResultsInf;
char Msg[4096];
Status = TOCRGetJobResultsEx(JobNo, mode, &ResultsInf, 0);
if ( Status != TOCR_OK ) {
//sprintf(Msg, "TOCRGetJobResultsEx failed - %d\n", Status);
//MessageBox(NULL, Msg, "getresults", MB_TASKMODAL | MB_TOPMOST | MB_ICONSTOP);
return FALSE;
}
if ( ResultsInf > 0 ) {
// Allocate memory for results
*Results = ( char * ) hb_xgrab( ResultsInf + 1 );
//memset( &Results, 0, sizeof( ResultsInf ) );
// Retrieve the results
Status = TOCRGetJobResultsEx(JobNo, mode, &ResultsInf, *Results);
if ( Status != TOCR_OK ) {
//sprintf(Msg, "TOCRGetJobResultsEx failed - %d\n", Status);
//MessageBox(NULL, Msg, "getresults", MB_TASKMODAL | MB_TOPMOST | MB_ICONSTOP);
hb_xfree( Results ); //free(*Results);
*Results = 0;
return FALSE;
}
} else {
//MessageBox(NULL, "No results found\n", "getresults", MB_TASKMODAL | MB_TOPMOST | MB_ICONSTOP);
return FALSE ;
}
return TRUE;
} // getresults()
//--------------------------------------------------------
// Get extended results
BOOL GetResults( long JobNo, TOCRRESULTSEX **Results )
{
return getresults( JobNo, TOCRGETRESULTS_EXTENDED, (void **)Results );
} // GetResults()
//--------------------------------------------------------
// Convert extended results to a string
BOOL FormatResults(TOCRRESULTSEX *Results, char *Msg)
{
long ItemNo;
long APos = 0;
BOOL Status = FALSE;
if ( Results->Hdr.NumItems > 0 ) {
for (ItemNo = 0; ItemNo < Results->Hdr.NumItems; ItemNo ++ ) {
if ( Results->Item[ItemNo].OCRCha == '\r' )
Msg[APos] = '\n';
else
Msg[APos] = (char)Results->Item[ItemNo].OCRCha;
APos ++;
}
Msg[APos] = 0;
Status = TRUE;
}
return Status;
} // FormatResults()
#pragma ENDDUMP
@ECHO OFF
CLS
if A%1 == A GOTO :SINTAX
if NOT EXIST %1.prg GOTO :NOEXIST
ECHO Compiling...
set FWDIR=.\..\
set XHDIR=f:\xharbour_1.2.1_6741
rem if "%2" == "/b" set GT=gtwin
rem if not "%2" == "/b" set GT=gtgui
set GT=gtgui
set hdir=%XHDIR%
set hdirl=%hdir%\lib
set bcdir=f:\borland\bcc582
set fwh=%FWDIR%
%hdir%\bin\harbour %1 /n /i%fwh%\include;%hdir%\include /w /p %2 %3 > comp.log
IF ERRORLEVEL 1 GOTO COMPILEERRORS
@type comp.log
echo -O2 -e%1.exe -I%hdir%\include -I%bcdir%\include %1.c > b32.bc
%bcdir%\bin\bcc32 -M -c -v @b32.bc
:ENDCOMPILE
IF EXIST %1.rc %bcdir%\bin\brc32 -r -I%bcdir%\include %1
echo %bcdir%\lib\c0w32.obj + > b32.bc
echo %1.obj, + >> b32.bc
echo %1.exe, + >> b32.bc
echo %1.map, + >> b32.bc
echo %fwh%\lib\Fivehx.lib %fwh%\lib\FiveHC.lib + >> b32.bc
echo %hdirl%\rddads.lib + >> b32.bc
echo %hdirl%\ace32.lib + >> b32.bc
echo %hdirl%\rtl.lib + >> b32.bc
echo %hdirl%\vm.lib + >> b32.bc
echo %hdirl%\%GT%.lib + >> b32.bc
echo %hdirl%\lang.lib + >> b32.bc
echo %hdirl%\macro.lib + >> b32.bc
echo %hdirl%\rdd.lib + >> b32.bc
echo %hdirl%\dbfntx.lib + >> b32.bc
echo %hdirl%\dbfcdx.lib + >> b32.bc
echo %hdirl%\dbffpt.lib + >> b32.bc
echo %hdirl%\hbsix.lib + >> b32.bc
echo %hdirl%\debug.lib + >> b32.bc
echo %hdirl%\common.lib + >> b32.bc
echo %hdirl%\pp.lib + >> b32.bc
echo %hdirl%\pcrepos.lib + >> b32.bc
echo %hdirl%\ct.lib + >> b32.bc
echo %hdirl%\zlib.lib + >> b32.bc
echo %hdirl%\hbzip.lib + >> b32.bc
echo %hdirl%\png.lib + >> b32.bc
echo %hdirl%\tocrdll.lib + >> b32.bc
rem Uncomment these two lines to use Advantage RDD
rem echo %hdir%\lib\rddads.lib + >> b32.bc
rem echo %hdir%\lib\Ace32.lib + >> b32.bc
echo %bcdir%\lib\cw32.lib + >> b32.bc
echo %bcdir%\lib\import32.lib + >> b32.bc
echo %bcdir%\lib\uuid.lib + >> b32.bc
echo %bcdir%\lib\psdk\odbc32.lib + >> b32.bc
echo %bcdir%\lib\psdk\rasapi32.lib + >> b32.bc
echo %bcdir%\lib\psdk\nddeapi.lib + >> b32.bc
echo %bcdir%\lib\psdk\msimg32.lib + >> b32.bc
echo %bcdir%\lib\psdk\psapi.lib + >> b32.bc
echo %bcdir%\lib\psdk\gdiplus.lib + >> b32.bc
echo %bcdir%\lib\psdk\iphlpapi.lib, >> b32.bc
IF EXIST %1.res echo %1.res >> b32.bc
rem uncomment this line to use the debugger and comment the following one
if %GT% == gtwin %bcdir%\bin\ilink32 -Gn -Tpe -s -v @b32.bc
IF ERRORLEVEL 1 GOTO LINKERROR
if %GT% == gtgui %bcdir%\bin\ilink32 -Gn -aa -Tpe -s -v @b32.bc
IF ERRORLEVEL 1 GOTO LINKERROR
ECHO * Application successfully built *
%1
GOTO EXIT
ECHO
rem delete temporary files
@del %1.c
:COMPILEERRORS
@type comp.log
ECHO * Compile errors *
GOTO EXIT
:LINKERROR
ECHO * Linking errors *
GOTO EXIT
:SINTAX
ECHO SYNTAX: Build [Program] {-- No especifiques la extensi¢n PRG
ECHO {-- Don't specify .PRG extension
GOTO EXIT
:NOEXIST
ECHO The specified PRG %1 does not exist
:EXIT
cnavarro wrote:When I obtain this errors has been usually because the parameter types did not match the definitions of the functions, so, although with the same name, they are not recognized
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 78 guests