link error while compile testscan.prg and tscan.prg

link error while compile testscan.prg and tscan.prg

Postby dutch » Thu Dec 01, 2005 12:38 pm

Dear All,

I try to recompile Testscan.pr tscan.prg. It's shown the error message as following either harbour and xharbour.

This is sample error message

Turbo Incremental Link 5.00 Copyright (c) 1997, 2000 Borland
Error: Unresolved external 'TWAIN_Acquire' referenced from D:\FWH\TSCAN32\TSCAN.OBJ
Error: Unresolved external 'TWAIN_FreeNative' referenced from D:\FWH\TSCAN32\TSCAN.OBJ
Error: Unresolved external 'TWAIN_SelectImageSource' referenced from D:\FWH\TSCAN32\TSCAN.OBJ
.....

What does it mean?

Regards,
Dutch
User avatar
dutch
 
Posts: 1543
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Postby mauricioajordao » Fri Dec 02, 2005 7:13 pm

Sawasdee , dutch.

i think your problem are BAT Compiler and linker or Files *.cfg are wrong..

Show mw BAT compiler file to help you ok

Mauricio (BRAZIL)
mauricioajordao
 
Posts: 78
Joined: Fri Dec 02, 2005 6:55 pm
Location: brazil

Postby dutch » Sun Dec 04, 2005 4:45 pm

Dear mauricio,

This is my batch fil.

Thanks in advance,
Dutch

@ECHO OFF
CLS
ECHO ฺฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฟ
ECHO ณ FiveWin for Harbour 2.5 - October 2004 Harbour development power ณ
ECHO ณ (c) FiveTech, 1993-2004 for Microsoft Windows 95/98/NT/2000/ME and XP ณ
ECHO ภฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤู
ECHO  ฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿

if A%1 == A GOTO :SINTAX
if NOT EXIST %1.prg GOTO :NOEXIST

ECHO Compiling...

set hdir=d:\harbour
set bcdir=d:\bcc55

%hdir%\bin\harbour %1 /n /i..\include;%hdir%\include /w /p %2 %3 > clip.log
@type clip.log
IF ERRORLEVEL 1 PAUSE
IF ERRORLEVEL 1 GOTO EXIT

echo -O2 -e%1.exe -I%hdir%\include %1.c > b32.bc
%bcdir%\bin\bcc32 -M -c @b32.bc
:ENDCOMPILE

%hdir%\bin\harbour tscan /n /i..\include;%hdir%\include /w /p %2 %3 > clip.log
@type clip.log
IF ERRORLEVEL 1 PAUSE
IF ERRORLEVEL 1 GOTO EXIT

echo -O2 -etscan.exe -I%hdir%\include tscan.c > b32.bc
%bcdir%\bin\bcc32 -M -c @b32.bc
:ENDCOMPILE

IF EXIST %1.rc %bcdir%\bin\brc32 -r %1

echo c0w32.obj + > b32.bc
echo %1.obj tscan.obj, + >> b32.bc
echo %1.exe, + >> b32.bc
echo %1.map, + >> b32.bc
echo ..\lib\FiveH.lib ..\lib\FiveHC.lib + >> b32.bc
echo %hdir%\lib\rtl.lib + >> b32.bc
echo %hdir%\lib\vm.lib + >> b32.bc
echo %hdir%\lib\gtwin.lib + >> b32.bc
echo %hdir%\lib\lang.lib + >> b32.bc
echo %hdir%\lib\macro.lib + >> b32.bc
echo %hdir%\lib\rdd.lib + >> b32.bc
echo %hdir%\lib\dbfntx.lib + >> b32.bc
echo %hdir%\lib\dbfcdx.lib + >> b32.bc
echo %hdir%\lib\dbfdbt.lib + >> b32.bc
echo %hdir%\lib\debug.lib + >> b32.bc
echo %hdir%\lib\common.lib + >> b32.bc
echo %hdir%\lib\pp.lib + >> b32.bc
echo %hdir%\lib\codepage.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\psdk\odbc32.lib + >> b32.bc
echo %bcdir%\lib\psdk\nddeapi.lib + >> b32.bc
echo %bcdir%\lib\psdk\iphlpapi.lib + >> b32.bc
echo %bcdir%\lib\psdk\rasapi32.lib, >> b32.bc

IF EXIST %1.res echo %1.res >> b32.bc
rem uncomment this line to use the debugger and comment the next one
rem %bcdir%\bin\ilink32 -Tpe -s @b32.bc
%bcdir%\bin\ilink32 -Gn -aa -Tpe -s @b32.bc

rem delete temporary files
@del %1.c
@del %1.il?

IF ERRORLEVEL 1 GOTO LINKERROR
ECHO * Application successfully built
%1
GOTO EXIT
ECHO

:LINKERROR
rem if exist meminfo.txt notepad meminfo.txt
rem PAUSE * 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
User avatar
dutch
 
Posts: 1543
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Postby mauricioajordao » Mon Dec 05, 2005 10:51 am

SAWASDEE , DUTCH

I think this , your Bat Compile haven´t External reference for Functions.

post your code, Because TWAIN_... Functions are DLL external.

If you need SCANNER FUNCTION Check TWAIN class.

mauricio..
mauricioajordao
 
Posts: 78
Joined: Fri Dec 02, 2005 6:55 pm
Location: brazil

Tscan class

Postby dutch » Mon Dec 05, 2005 5:46 pm

Dear Mauricio

This is TSCAN.PRG code.

Thanks in advance,
Dutch

// Example scanner, Class TSCAN32 and Wrappers for [x]Harbour
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
// the GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this software; see the file COPYING. If not, write to
// the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
// Boston, MA 02111-1307 USA (or visit the web site
// http://www.gnu.org/).

// The exception is that, if you link the class Tscan32 and Wrappers C
// with other files to produce an executable, this does not by itself cause the
// resulting executable to be covered by the GNU General Public License.
// Your use of that executable is in no way restricted on account of
// linking the Tscan32 and Wrappers library code into it.

// 2003(c)- Rafa Carmona( Thefull )
//
// interface to Dosadi EZTWAIN library by TheFull
// Interface para la libreria EZTWAIN de Dosadi por TheFull
// 32 bits

// ATENTION. THIS LICENSE NOT APLICATTE A EZTWAIN.
// YOUR VIEW LICENSE EZTW32.DLL IN WWW.DOSADI.COM

#INCLUDE "HBCLASS.CH"


// Returns the TWAIN Protocol State per the spec.
#define TWAIN_PRESESSION 1 // source manager not loaded
#define TWAIN_SM_LOADED 2 // source manager loaded
#define TWAIN_SM_OPEN 3 // source manager open
#define TWAIN_SOURCE_OPEN 4 // source open but not enabled
#define TWAIN_SOURCE_ENABLED 5 // source enabled to acquire
#define TWAIN_TRANSFER_READY 6 // image ready to transfer
#define TWAIN_TRANSFERRING 7 // image in transit

***************************************************************************
*
* CLASS TSCAN32
* 2003(c)- by Rafa Carmona ( TheFull )
* Beta 1.0
* Beta 2.0 New. Support Get ClipBoard to hDib.
* New. ClipboardToFile( cFile ) -> Save File Jpg into Clipboard.
*
* Beta 3.0 New. ReWrite Method End, conflict GPF's ;)
*
*
****************************************************************************

CLASS TSCAN32

DATA hWnd
DATA cFile
DATA hDib
DATA lError INIT .F.
DATA nState

METHOD New( cFile, hWnd ) CONSTRUCTOR
METHOD End()
METHOD Register()
MESSAGE FreeNative METHOD End()
MESSAGE Close METHOD End()

METHOD DigiToFile( cFile )
METHOD DibToJpeg( cFile ) INLINE TW_DibWJpg( ::hDib, cFile )
METHOD DibToBmp( cFile ) INLINE TW_DibWBmp( ::hDib, cFile )
METHOD SetJpegQ( nQuality) INLINE TW_SetJpegQuality( nQuality )// 1..100 Default 75

METHOD Acquire() INLINE TW_Acquire( ::hWnd )
METHOD AcquireClipBoard() INLINE TW_AcquireToClipboard( ::hWnd , 0 )

METHOD OpenDefault()
METHOD OpenSource()
METHOD EnableSource() INLINE TW_EnableSource( ::hWnd )
METHOD Choose() INLINE TW_SelectImageSource()

// ********** Basic TWAIN Inquiries **********************************
METHOD IsAvailable() INLINE IIF( TW_Avail() = 1, .T. , .F. )
METHOD Version() INLINE ( Str( TW_EasyVersion() / 100 ) )
METHOD State() INLINE (::nState := TW_State() )
METHOD SourceName() INLINE TW_SourceName()
METHOD GetSourceName( cName ) INLINE TW_GetSourceName( cName )


//************ Global Options *****************************************
METHOD SetHide( lHide ) INLINE IIF( lHide , TW_SetHideUI(1), TW_SetHideUI(0) )


//-*********** High-level Capability Negotiation Functions **************
// These functions should only be called in State 4 (TWAIN_SOURCE_OPEN)
METHOD PixelType( nType ) INLINE ( ::State(),;
if( ::nState >= TWAIN_SOURCE_OPEN,;
TW_SetCurrentPixelType( nType ),0 ) )
METHOD SetRes( dRes ) INLINE ( ::State(),;
if( ::nState >= TWAIN_SOURCE_OPEN,;
TW_SetCurrentResolution( dRes ),0) )
METHOD SetXRes( dRes ) INLINE TW_SetXResolution( dRes )
METHOD SetYRes( dRes ) INLINE TW_SetYResolution( dRes )
METHOD SetUnits( nUnits ) INLINE TW_SETCURRENTUNITS( nUnits )
METHOD SetContrats( dContrats) INLINE TW_SETCONTRATS( dContrats )
METHOD SetBright( dBright ) INLINE TW_SETBRIGHTNESS( dBright )
METHOD SetPaper( nPaper ) INLINE TW_SETPAPERSIZE( nPaper )
METHOD GetResolution() INLINE TW_GETCURRENTRESOLUTION()


//******** Image Layout (Region of Interest) **********************
METHOD RegionSet( nLeft,nTop, nRigth, nBottom ) INLINE TW_SetImageLayout( nLeft,nTop, nRigth, nBottom )
METHOD RegionReset() INLINE TW_ResetImageLayout()
METHOD RegionGet( L,T,R,B ) INLINE TW_GetImageLayout(@L,@T,@R,@B)
METHOD RegionGetDefault( L,T,R,B ) INLINE TW_GetDefaultImageLayout(@L,@T,@R,@B)

METHOD ClipBoardToFile( cFile )
METHOD DIB_GetFromClipboard() INLINE TW_DIB_GetFromClipboard()

ENDCLASS

***********************************************************
***********************************************************
METHOD New( cFile, hWnd ) CLASS TSCAN32

IF Empty( hWnd )
::hWnd := GetActiveWindow()
ENDIF

IF Empty( cFile )
::cFile := "TestTscan32.jpg"
ELSE
::cFile := cFile
ENDIF


IF !::IsAvailable()
::lError := .T.
// MsgStop( "TWAIN no found","Attention!") // Only Fivewin
ENDIF

IF !::lError
::Register( 1,0,0,0,"1.0 Beta","by Rafa Carmona","Scan by Thefull","Scan For [x]Harbour" )
ENDIF
::OpenSource()
::OpenDefault()

RETURN Self

**********************************************************************
* Comprueba que esta disponible TWAIN y cargalo
**********************************************************************
METHOD OpenSource() CLASS TSCAN32
Local nResult := TW_LoadSourceManager()

DO CASE
CASE nResult = -1
::lError := .T.
// MsgStop("Error Driver TWAIN"," ฟ Insufficient Memory ?")
Return Self
ENDCASE

Return Self

***********************************************************************
* Abre TWAIN el ultimo que fue seleccionado desde Select ..Dialog
* Si no puede cargarlo solicita seleccionar Source.
***********************************************************************
METHOD OpenDefault() CLASS TSCAN32
Local nResult := TW_OpenDefaultSource()

DO CASE
CASE nResult = 0
::Choose()
CASE nResult = -1
::lError := .T.
OTHERWISE
::lError := .F.
ENDCASE

Return Self

**************************************************************************
* Liberamos hDib y cerramos el dispositivo
**************************************************************************
METHOD End() CLASS TSCAN32

if !Empty( ::hDib )
TW_Free( ::hDib )
endif

TW_CloseSourceManager( ::hWnd ) // Close para evitar GPF

Return NIL

***************************************************************************
* Registra la aplicacion
***************************************************************************
METHOD Register( nMajor ,nMinor,nLanguage,nCountry,cVersion,cName,cFamily,cProduct ) CLASS TSCAN32

TW_REGISTERAPP( nMajor ,nMinor,nLanguage,nCountry,;
cVersion,cName,cFamily,cProduct )

Return Self

***********************************************************
* Digitaliza hacia un fichero .jpg
***********************************************************
METHOD DigiToFile( cFile )

if EMPTY( cFile )
cFile := ::cFile
endif

IF !::lError
::hDib := ::Acquire() // Importar
ENDIF

IF !Empty( ::hDib )

IF TW_IsJpg() = 1 // Si puede hacer uso del JPG
::DibToJpeg( cFile )
ELSE
::DibToBmp( cFile ) // Si no hacemos uso de BMP
ENDIF

ENDIF

Return Self


************************************************************************
* Save content clipboard into to file.jpg
************************************************************************
METHOD ClipBoardToFile( cFile ) CLASS TSCAN32
Local hDib, nError

IF Empty( cFile )
::cFile := "TestTscan32.jpg"
ELSE
::cFile := cFile
ENDIF

hDib := ::DIB_GetFromClipboard()


IF !Empty( hDib )

IF TW_IsJpg() = 1 // Si puede hacer uso del JPG
TW_DibWJpg( hDib, ::cFile )
ELSE
TW_DibWBmp( hDib, ::cFile )
ENDIF

TW_Free( hDib )

ENDIF

RETURN Self
/* -----------------------------------------------------------------
Implementation Language C for [x]Harbour(WIN32)
2003(c)- by Rafa Carmona ( TheFull )

Wrappers for EZTW32.DLL the DosAdi.

-------------------------------------------------------------------- */
#pragma BEGINDUMP

#include <windows.h>
#include "eztwain.h"
#include "hbapi.h"


/*--------- Top-Level Calls -------------------------------------*/

HB_FUNC( TW_ACQUIRE ) // hWnd
{
hb_retnl( ( LONG )TWAIN_Acquire( ( HWND ) hb_parnl( 1 ) ) );
}

HB_FUNC( TW_FREE ) // hDib
{
TWAIN_FreeNative( ( HANDLE ) hb_parnl( 1 ) );
hb_ret();
}

HB_FUNC( TW_SELECTIMAGESOURCE ) // hWnd
{ ;
hb_retni( TWAIN_SelectImageSource( ( HWND ) hb_parnl( 1 ) ) );
}

HB_FUNC( TW_ACQUIRENATIVE ) // hWnd, nPixTypes
{
hb_retnl( ( LONG )TWAIN_AcquireNative( ( HWND ) hb_parnl( 1 ), (unsigned) hb_parni(2) ) );
}

HB_FUNC( TW_ACQUIRETOCLIPBOARD ) // hWnd, nPixTypes
{
hb_retni( TWAIN_AcquireToClipboard( ( HWND ) hb_parnl( 1 ), (unsigned) hb_parni(2) ) );
}

HB_FUNC( TW_ACQUIREMEMORY ) // hWnd
{
hb_retnl( ( LONG )TWAIN_AcquireMemory( ( HWND ) hb_parnl( 1 ) ) );
}

HB_FUNC( TW_ACQUIRETOFILENAME ) // hWnd, cFileName
{
hb_retni( TWAIN_AcquireToFilename( ( HWND ) hb_parnl( 1 ), hb_parc( 2 ) ) );
}

HB_FUNC( TW_ACQUIREFILE ) // hWnd, nFF, cFileName
{
hb_retni( TWAIN_AcquireFile( ( HWND ) hb_parnl( 1 ), hb_parni( 2 ) ,hb_parc( 3 ) ) );
}


//--------- Basic TWAIN Inquiries

HB_FUNC( TW_AVAIL )
{
hb_retni( TWAIN_IsAvailable() );
}

HB_FUNC( TW_EASYVERSION)
{
hb_retni( TWAIN_EasyVersion() );
}

HB_FUNC( TW_STATE )
{
hb_retni( TWAIN_State() );
}

HB_FUNC( TW_SOURCENAME )
{
hb_retc( TWAIN_SourceName() );
}

HB_FUNC( TW_GETSOURCENAME ) // pzName
{
TWAIN_GetSourceName( (LPSTR) hb_parc( 1 ) );
hb_ret();
}


//--------- DIB handling utilities ---------

HB_FUNC( TW_DIBWJPG ) // hDib, cName
{
hb_parni( DIB_WriteToJpeg( ( HANDLE ) hb_parnl(1), hb_parc( 2 ) ) );
}

HB_FUNC( TW_DIBWBMP ) // hDib, cName
{
hb_parni( DIB_WriteToBmp( ( HANDLE ) hb_parnl(1), hb_parc( 2 ) ) );
}


//--------- File Read/Write

HB_FUNC( TW_ISJPG )
{
hb_retni( TWAIN_IsJpegAvailable() );
}

HB_FUNC( TW_SETSAVEFORMAT )
{
hb_retni( TWAIN_SetSaveFormat( hb_parni( 1 ) ) );
}

HB_FUNC( TW_GETSAVEFORMAT )
{
hb_retni( TWAIN_GetSaveFormat() );
}

HB_FUNC( TW_SETJPEGQUALITY ) // nQuality 1...100
{
TWAIN_SetJpegQuality( hb_parni( 1 ) );
hb_ret();
}

HB_FUNC( TW_GETJPEGQUALITY )
{
hb_retni( TWAIN_GetJpegQuality() );
}

HB_FUNC( TW_WRITENATIVETOFILENAME )
{
hb_retni( TWAIN_WriteNativeToFilename( (HANDLE) hb_parnl(1), hb_parc(2) ));
}

HB_FUNC( TW_LOADNATIVEFROMFILENAME )
{
hb_retnl( (LONG) TWAIN_LoadNativeFromFilename( hb_parc( 1 ) ) );
}



//--------- Global Options ----------------------------------------------
HB_FUNC( TW_SETMULTITRANSFER )
{
TWAIN_SetMultiTransfer( hb_parni( 1 ) );
hb_ret();
}

HB_FUNC( TW_GETMULTITRANSFER )
{
hb_retni( TWAIN_GetMultiTransfer() );
}

HB_FUNC( TW_SETHIDEUI ) // nHide
{
TWAIN_SetHideUI( hb_parni( 1) );
hb_ret();
}

HB_FUNC( TW_GETHIDEUI )
{
hb_retni( TWAIN_GetHideUI() );
}


HB_FUNC( TW_DISABLEPARENT )
{
TWAIN_DisableParent( hb_parni( 1 ) );
hb_ret();
}

HB_FUNC( TW_GETDISABLEPARENT )
{
hb_retni( TWAIN_GetDisableParent() );
}

HB_FUNC( TW_REGISTERAPP )
{

TWAIN_RegisterApp( hb_parni(1),hb_parni(2),hb_parni(3),hb_parni(4),
hb_parc(5), hb_parc(6),
hb_parc(7), hb_parc(8) );
hb_ret();
}

HB_FUNC( TW_SETAPPTITLE )
{
TWAIN_SetAppTitle( hb_parc( 1 ) );
hb_ret();
}




//--------- TWAIN State Control ---------------------------------------

HB_FUNC( TW_LOADSOURCEMANAGER )
{
hb_retni( TWAIN_LoadSourceManager() );
}

HB_FUNC( TW_OPENSOURCEMANAGER ) // hWnd
{
hb_retni( TWAIN_OpenSourceManager( ( HWND ) hb_parnl( 1 ) ) );
}

HB_FUNC( TW_OPENDEFAULTSOURCE )
{
hb_retni( TWAIN_OpenDefaultSource() );
}

HB_FUNC( TW_GETSOURCELIST )
{
hb_retni( TWAIN_GetSourceList() );
}

HB_FUNC( TW_GETNEXTSOURCENAME )
{
hb_retni( TWAIN_GetNextSourceName( hb_parc( 1 ) ) );
}

HB_FUNC( TW_GETDEFAULTSOURCENAME )
{
hb_retni( TWAIN_GetDefaultSourceName( hb_parc( 1 ) ));
}

HB_FUNC( TW_OPENSOURCE )
{
hb_retni( TWAIN_OpenSource( hb_parc( 1 ) ) );
}

HB_FUNC( TW_ENABLESOURCE ) // hWnd
{
hb_retni( TWAIN_EnableSource( ( HWND ) hb_parnl( 1 ) ) );
}

HB_FUNC( TW_DISABLESOURCE )
{
hb_retni( TWAIN_DisableSource( ) );

}

HB_FUNC( TW_CLOSESOURCE )
{
hb_retni( TWAIN_CloseSource() );
}

HB_FUNC( TW_CLOSESOURCEMANAGER )
{
hb_retni( TWAIN_CloseSourceManager( (HWND) hb_parnl( 1 ) ) );
}

HB_FUNC( TW_UNLOADSOURCEMANEGER )
{
hb_retni( TWAIN_UnloadSourceManager() );
}



//--------- High-level Capability Negotiation Functions --------------
// These functions should only be called in State 4 (TWAIN_SOURCE_OPEN)

HB_FUNC( TW_GETCURRENTUNITS )
{
hb_retni( TWAIN_GetCurrentUnits() );
}

HB_FUNC( TW_SETCURRENTUNITS ) // nUnits
{
hb_retni( TWAIN_SetCurrentUnits( hb_parni( 1 ) ) );
}

HB_FUNC( TW_GETBITDEPTH )
{
hb_retni( TWAIN_GetBitDepth() );
}

HB_FUNC( TW_SETBITDEPTH )
{
hb_retni( TWAIN_SetBitDepth( hb_parni( 1 ) ) );
}

HB_FUNC( TW_GETPIXELTYPE )
{
hb_retni( TWAIN_GetPixelType() );
}

HB_FUNC( TW_SETCURRENTPIXELTYPE ) // nBits
{
hb_retni( TWAIN_SetCurrentPixelType( hb_parni( 1 ) ) );
}

HB_FUNC( TW_GETCURRENTRESOLUTION )
{
hb_retnd( TWAIN_GetCurrentResolution());
}

HB_FUNC( TW_GETYRESOLUTION )
{
hb_retnd( TWAIN_GetYResolution());
}

HB_FUNC( TW_SETCURRENTRESOLUTION ) // dRes
{
hb_retni( TWAIN_SetCurrentResolution( hb_parnd( 1 ) ) );
}

HB_FUNC( TW_SETXRESOLUTION )
{
hb_retni( TWAIN_SetXResolution( hb_parnd( 1 ) ) );
}

HB_FUNC( TW_SETYRESOLUTION )
{
hb_retni( TWAIN_SetYResolution( hb_parnd( 1 ) ) );
}

HB_FUNC( TW_SETCONTRATS ) //dCon
{
hb_retni( TWAIN_SetContrast( hb_parnd( 1 ) ) ); // -1000....+1000
}

HB_FUNC( TW_SETBRIGHTNESS ) //dBri
{
hb_retni( TWAIN_SetBrightness( hb_parnd( 1 ) ) ); // -1000....+1000
}

HB_FUNC( TW_SETTHRESHOLD )
{
hb_retni( TWAIN_SetThreshold( hb_parnd( 1 ) ) );
}

HB_FUNC( TW_GETCURRENTTHRESHOLD )
{
hb_retnd( TWAIN_GetCurrentThreshold() );
}

HB_FUNC( TW_SETXFERMECH )
{
hb_retni( TWAIN_SetXferMech( hb_parni( 1 ) ) );
}

HB_FUNC( TW_XFERMECH )
{
hb_retni( TWAIN_XferMech() );
}

HB_FUNC( TW_SUPPORTSFILEXFER )
{
hb_retni( TWAIN_SupportsFileXfer() );
}

HB_FUNC( TW_SETPAPERSIZE ) // nTypePaper
{
hb_retni( TWAIN_SetPaperSize( hb_parni( 1 ) ) );
}

//-------- Document Feeder ---------------------------------

HB_FUNC( TW_HASFEEDER )
{
hb_retl( TWAIN_HasFeeder() );
}

HB_FUNC( TW_ISFEEDERSELECTED )
{
hb_retl( TWAIN_IsFeederSelected() );
}

HB_FUNC( TW_SELECTFEEDER )
{
hb_retni( TWAIN_SelectFeeder( hb_parni( 1 ) ) );
}

HB_FUNC( TW_ISAUTOFEEDON )
{
hb_retl( TWAIN_IsAutoFeedOn() );
}

HB_FUNC( TW_SETAUTOFEDD )
{
hb_retni( TWAIN_SetAutoFeed( hb_parni( 1 ) ) );
}

HB_FUNC( TW_ISFEEDERLOADED )
{
hb_retl( TWAIN_IsFeederLoaded() );
}

//-------- Duplex Scanning ------------------------------------------
HB_FUNC( TW_GETDUPLEXSUPPORT )
{
hb_retni( TWAIN_GetDuplexSupport() );
}

HB_FUNC( TW_ENABLEDUPLEX )
{
hb_retni( TWAIN_EnableDuplex( hb_parni( 1 ) ) );
}

HB_FUNC( TW_ISDUPLEXENABLED )
{
hb_retl( TWAIN_IsDuplexEnabled() );
}

//--------- Other 'exotic' capabilities --------

HB_FUNC( TW_HASCONTROLLABLEUI )
{
hb_retni( TWAIN_HasControllableUI() );
}

HB_FUNC( TW_SETINDICATORS )
{
hb_retni( TWAIN_SetIndicators( hb_parl( 1 ) ) );
}

HB_FUNC( TW_COMPRESSION )
{
hb_retni( TWAIN_Compression() );
}

HB_FUNC( TW_SETCOMPRESSION )
{
hb_retni( TWAIN_SetCompression( hb_parni( 1 ) ) );
}

HB_FUNC( TW_TILED )
{
hb_retl( TWAIN_Tiled() );
}

HB_FUNC( TW_SETTILED )
{
hb_retni( TWAIN_SetTiled( hb_parl( 1 ) ) );
}

HB_FUNC( TW_PLANARCHUNKY )
{
hb_retni( TWAIN_PlanarChunky() );
}

HB_FUNC( TW_SETPLANARCHUNKY )
{
hb_retni( TWAIN_SetPlanarChunky( hb_parni( 1 ) ) );
}

HB_FUNC( TW_PIXELFLAVOR )
{
hb_retni( TWAIN_PixelFlavor() );
}

HB_FUNC( TW_SETPIXELFLAVOR )
{
hb_retni( TWAIN_SetPixelFlavor( hb_parni( 1 ) ) );
}

HB_FUNC( TW_SETLIGHTPATH )
{
hb_retni( TWAIN_SetLightPath( hb_parl( 1 ) ) );
}

HB_FUNC( TW_SETAUTOBRIGHT )
{
hb_retni( TWAIN_SetAutoBright( hb_parl( 1 ) ) );
}

HB_FUNC( TW_SETGAMMA )
{
hb_retni( TWAIN_SetGamma( hb_parnd( 1 ) ) );
}

HB_FUNC( TW_SETSHADOW )
{
hb_retni( TWAIN_SetShadow( hb_parnd( 1 ) ) );
}

HB_FUNC( TW_SETHIGHLIGHT )
{
hb_retni( TWAIN_SetHighlight( hb_parnd( 1 ) ) );
}
//--------- Image Layout (Region of Interest) --------


HB_FUNC( TW_SETIMAGELAYOUT ) // left, top, right, bottom
{
hb_retni( TWAIN_SetImageLayout( hb_parnd( 1 ),hb_parnd( 2 ),hb_parnd( 3 ),hb_parnd( 4 ) ) );
}

HB_FUNC( TW_RESETIMAGELAYOUT )
{
TWAIN_ResetImageLayout();
hb_ret();
}

HB_FUNC( TW_GETIMAGELAYOUT )
{
double L,T,R,B;
int nRet;

nRet = TWAIN_GetImageLayout( &L,&T,&R,&B );

hb_stornd( L, 1 );
hb_stornd( T, 2 );
hb_stornd( R, 3 );
hb_stornd( B, 4 );
hb_retni( nRet );
}

HB_FUNC( TW_GETDEFAULTIMAGELAYOUT )
{
double L,T,R,B;
int nRet;

nRet = TWAIN_GetDefaultImageLayout( &L, &T, &R, &B);

hb_stornd( L, 1 );
hb_stornd( T, 2 );
hb_stornd( R, 3 );
hb_stornd( B, 4 );
hb_retni( nRet );
}

//HANDLE EZTAPI DIB_GetFromClipboard(void);
HB_FUNC( TW_DIB_GETFROMCLIPBOARD )
{
hb_retnl( (LONG) DIB_GetFromClipboard() );
}

// para no depender de Five, y harbour poder el solito trabajar ;)
HB_FUNC ( GETACTIVEWINDOW )
{
hb_retnl( ( LONG ) GetActiveWindow() );
}

#pragma ENDDUMP
User avatar
dutch
 
Posts: 1543
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

testscan.prg

Postby dutch » Mon Dec 05, 2005 5:48 pm

Dear Mauricio,

This is testscan.prg

#INCLUDE "Fivewin.ch"

// BitDeph
#define TWPT_BW 0 /* Black and White */
#define TWPT_GRAY 1
#define TWPT_RGB 2
#define TWPT_PALETTE 3

//----- Unit of Measure
#define TWUN_INCHES 0
#define TWUN_CENTIMETERS 1
#define TWUN_PICAS 2
#define TWUN_POINTS 3
#define TWUN_TWIPS 4
#define TWUN_PIXELS 5


/* ----------------------------------------------------------------
Control de Pruebas de la Clase TSCAN32, Wrappers
para Scanners y WebCams.

- Soporta scanners Paralelo, USB y SCSI.
- WebCams

(c)2003.- by Rafa Carmona( TheFull )
Compiler & Libraries
- Harbour and Fivewin For Harbour v2.3

--------------------------------------------------------------- */

Static oScan, oWnd
Static X := 0
Static Y := 0
Static lChangeUnit := .F.

Function Main( cFile, nType, nRes, lHide, nPaper )

Local hDib := 0
Local oImage, oBar, oBtn, oFont, oCbx, oCbxU, oCbxR, oGet, oCheck
Local lSave := .F.
Local cType
Local aTypes := { "1-Scale Gray","2-Real Color","3-Palette Color" }
Local aResolutions := { "75","100","150","200","300" }
Local aUnits := { "0-Dpi","1-Cms","2-Picas","3-Points","4-Twips","6-Pixels"}
Local cUnit := aUnits[1]
Local nUnit := 0

// Default RGB
IF nType == NIL
nType := TWPT_GRAY
ELSEIF Val( nType ) <= 3
nType := Val( nType )
ELSEIF Val( nType ) > 3
MsgStop( "Not exist type." + CRLF+;
"Real Color by Default", "Atention" )
nType := TWPT_RGB
ENDIF

cType := aTypes[ nType ]

IF cFile = NIL
cFile := ""
ENDIF

//Default 150dpi
IF nRes = NIL
nRes := "150"
ENDIF

oScan := TScan32():New( cFile )

DEFINE FONT oFont NAME"Tahoma" SIZE 0,-10


DEFINE WINDOW oWnd TITLE "Fichero: "+ oScan:cFile FROM 1,1 TO 500,650 PIXEL


DEFINE BUTTONBAR oBar SIZE 50,32 3D OF oWnd

DEFINE BUTTON oBtn PROMPT "Exit" FONT oFont ;
ACTION oWnd:End() OF oBar

DEFINE BUTTON oBtn PROMPT "Grabar" FONT oFont ;
ACTION ( oScan:ClipBoardToFile( cFile ),;
SysRefresh() ) OF oBar

DEFINE BUTTON oBtn PROMPT "Scan" FONT oFont ;
ACTION IF( ScanFive( nType , nRes, nUnit ),;
( oImage:LoadFromClipboard(), oImage:Refresh()) ,) OF oBar

@5,175 CHECKBOX oCheck VAR lChangeUnit PROMPT "SetUnit" SIZE 70,20 OF oBar PIXEL

@3,250 COMBOBOX oCbxR VAR nRes SIZE 100,130 ;
ITEMS aResolutions OF oBar PIXEL ;
WHEN nUnit = 0 UPDATE

@3,350 COMBOBOX oCbx VAR cType SIZE 120,130 ;
ITEMS aTypes OF oBar PIXEL ;
ON CHANGE nType := Val( SubStr( cType,1,1 ) )

@3,470 COMBOBOX oCbxU VAR cUnit SIZE 100,130 ;
ITEMS aUnits OF oBar PIXEL ;
ON CHANGE nUnit := Val( SubStr( cUnit,1,1 ) ) ;
UPDATE

@7,570 GET oGet VAR X PICTURE "9999.99" SIZE 60,20 OF oBar ;
UPDATE PIXEL

@7,630 GET oGet VAR Y PICTURE "9999.99" SIZE 60,20 OF oBar ;
UPDATE PIXEL


@0,0 BITMAP oImage SCROLL OF oWnd
oWnd:oClient := oImage

oWnd:Center()

SET MESSAGE TO "(c)2003-Scan ClipBoard Beta 2 by Rafa Carmona" OF oWnd CENTER

// Vaciamos el Clipboard a la salida de la Aplicacion.
// Empty Clipboard to Exit aplicattion.
ACTIVATE WINDOW oWnd VALID( oFont:End(), oScan:End(),;
OpenClipBoard( oWnd:hWnd ),;
EmptyClipboard(),;
CloseClipBoard(),.T. )


Return NIL


// Scanner al Clipboard
// nType -> Tipo de Salida
// nRes -> Resolucion de salida
// nUnit -> Sistema de Medida

Static Func ScanFive( nType, nRes , nUnit )

if oScan:State() < 4
oScan:OpenDefault()
endif

if nUnit = 0
oScan:SetRes( Val( nRes ) )
endif

IF nUnit > 0
if lChangeUnit
oScan:SetUnits( nUnit ) // Sistema de Medida .Esto puede causar problema
endif
// Expresado en Dpi. Habria que convertir pero no tengo ni idea de como.
oScan:SetXRes( X )
oScan:SetYRes( Y )
ENDIF

oScan:SetHide( .T. ) // Oculto DS
oScan:PixelType( nType )

Return IF( oScan:AcquireClipBoard() = 1,.T.,.F.)
User avatar
dutch
 
Posts: 1543
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

dutch

Postby mauricioajordao » Mon Dec 05, 2005 6:29 pm

I think This , How Many Files have this Class , your bat files don´t have library to undefined Functions if external .. declare..

Extern ...

What Files have this class?

Mauricio (BRAZIL)
mauricioajordao
 
Posts: 78
Joined: Fri Dec 02, 2005 6:55 pm
Location: brazil

EZTW32.LIB

Postby dutch » Mon Dec 05, 2005 7:17 pm

Dear Mauricio,

This classes come from www.dosadi.com EZTWAIN

Regards,
Dutch
User avatar
dutch
 
Posts: 1543
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Postby mauricioajordao » Mon Dec 05, 2005 7:52 pm

DEAR DUTCH,

I THINK THIS , do you have Using Dll Via DLL32

i don´t get this classe , send me ..ok

mauricioajordao@msn.com

Together found Solutions OK

mauricio (BRAZIL)
mauricioajordao
 
Posts: 78
Joined: Fri Dec 02, 2005 6:55 pm
Location: brazil

Postby George » Sat Apr 19, 2008 7:22 pm

Dutch

I am having the same problem that you are having when trying to compile the TSCAN.PRG:
Code: Select all  Expand view  RUN
xLINK: error: Unresolved external symbol '_TWAIN_Acquire'.

xLINK: error: Unresolved external symbol '_TWAIN_FreeNative'.

xLINK: error: Unresolved external symbol '_TWAIN_SelectImageSource'.

xLINK: error: Unresolved external symbol '_TWAIN_AcquireNative'.

xLINK: error: Unresolved external symbol '_TWAIN_AcquireToClipboard'.

xLINK: error: Unresolved external symbol '_TWAIN_AcquireMemory'.

xLINK: error: Unresolved external symbol '_TWAIN_AcquireToFilename'.


Did you find a solution to this problem?


Regards,


George
George
 
Posts: 725
Joined: Tue Oct 18, 2005 6:49 pm

Postby dutch » Sat Apr 19, 2008 7:35 pm

Dear George,

This following code that I use.

Regards,
Dutch
George wrote:Dutch

I am having the same problem that you are having when trying to compile the TSCAN.PRG:
Code: Select all  Expand view  RUN
xLINK: error: Unresolved external symbol '_TWAIN_Acquire'.

xLINK: error: Unresolved external symbol '_TWAIN_FreeNative'.

xLINK: error: Unresolved external symbol '_TWAIN_SelectImageSource'.

xLINK: error: Unresolved external symbol '_TWAIN_AcquireNative'.

xLINK: error: Unresolved external symbol '_TWAIN_AcquireToClipboard'.

xLINK: error: Unresolved external symbol '_TWAIN_AcquireMemory'.

xLINK: error: Unresolved external symbol '_TWAIN_AcquireToFilename'.


Did you find a solution to this problem?


Regards,


George


Code: Select all  Expand view  RUN
/*------------------------------------------------------------------------*
     ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
   Ûݳ                                                                   ³
   Ûݳ ProcName......: Scanner.prg                                       ³
   Ûݳ Pourpose......: TWAIN standard device Class interface             ³
   Ûݳ Date..........: 05-11-96                                          ³
   Ûݳ Author........: (c),L.Gadaleta                                    ³
   Ûݳ                                                                   ³
   ÛÝÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
   ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
*------------------------------------------------------------------------*/
#include "FiveWin.ch"
#include "Image.ch"

#define STAND_ALONE

#define TWAIN_DLL             "EZTw32.dll"
* #define TWAIN_DLL             "DMTwain.dll"

#define CBM_INIT 4    // for freeimage.dll

#define DIB_RGB_COLORS 0 // for freeimage.dll

STATIC oWnd, oImage
STATIC hLib              // for freeimage.dll



#ifdef STAND_ALONE

FUNCTION ScanMe(cFileRes)

LOCAL cFile, nRes, n
cFile := cFileRes 
nRes  := 100
if !cFileRes == NIL
   if ( n:=AT(",",cFileRes) ) > 0
      cFile := Alltrim(Substr(cFileRes,1,n-1))
      nRes  := Val(Alltrim(Substr(cFileRes,n+1)))
   end
end

CursorWait()

DEFINE WINDOW oWnd FROM 1,1 TO 1,1
       
ACTIVATE WINDOW oWnd ON INIT (oWnd:Hide(), ;
                              RunScan(cFile,oWnd:hWnd,nRes))

if file( cFile )
   SaveImage( cFile )
end

CursorArrow()

RETURN NIL

STATIC FUNCTION RunScan(cFile,hWnd,nRes)
LOCAL oScanner := Scanner():New(hWnd)
DEFAULT nRes := 100                                     // Scanner resolution in Dpi
   oScanner:Choose()
   oScanner:Set(.T.)                                       // Set User Interface Off
   oScanner:DigiToFile(cFile,nRes)                         // Acquires
   oScanner:End()
   oWnd:End()
RETURN NIL

#endif

CLASS Scanner
   DATA   hWnd   AS NUMERIC   // Handle of the window
   DATA   hDll   AS NUMERIC   // Handle of the DLL
   DATA   lLoad  AS LOGICAL   //   .T. DLL & Driver Loaded
   DATA   hDib   AS NUMERIC   // Current Dib handle
   *
   METHOD New()         CONSTRUCTOR
   METHOD End()
        METHOD Set()                    // Acquiring Dialog ON/OFF
   METHOD Choose()         // Select Image Device Source
   METHOD DigiToFile()      // Acquire Image and save to a file
   METHOD DigiToClip()      // Acquire Image and copy to ClipBoard
        METHOD SetResolution()          // Set Dpi for the scanner
   *
   PROTECTED :
      METHOD Free()         // Release Dib's handle
      METHOD IsActive()      // Twain Driver Loaded
      METHOD Register()      // Register my application into Twain application
                METHOD DibToFile()              // Write to file Dib's handle in BMP format
END CLASS

METHOD New(hWnd)
// Constructor
::hWnd := iif( ValType( hWnd ) == "N" , hWnd , 0 )
::lLoad := .T.
::hDLL := LoadLibrary( TWAIN_DLL )
::hDib := 0
if ::hDll <= 21
   ::lLoad := .F.
   MsgAlert( BuildError(::hDll) , TWAIN_DLL )
   RETU Self
end
if ( ::lLoad := ::IsActive() )
   ::Register()
end
RETU Self

METHOD End()
// Destructor
if ::hDib != 0
   ::Free( ::hDib )
end
FreeLibrary( ::hDll )
RETU NIL

METHOD DigiToFile( cFile , nRes )
// Acquire Document & save to file
LOCAL nPixType := 0
LOCAL cFarProc
DEFAULT nRes := 100
::SetResolution( nRes )

if ::lLoad
   cFarProc := GetProcAddress( ::hDLL, "TWAIN_AcquireNative",.T., WORD,WORD,_INT )
   ::hDib  := CallDLL( cFarProc,::hWnd,nPixType )
   if ::hDib == 0
                MsgInfo("Cannot Load Image, Scanner not found","")
   else
      ::DibToFile(::hDib,cFile)
      ::Free( ::hDib )
   end
end
RETU Self

METHOD DigiToClip()
// Acquire document & copy to ClipBoard
LOCAL nPixType := 0
LOCAL cFarProc
LOCAL nResult
if ::lLoad
   cFarProc := GetProcAddress( ::hDLL, "TWAIN_AcquireToClipBoard",.T., _INT,WORD,_INT )
   nResult  := CallDLL( cFarProc,::hWnd,nPixType )
end
RETU Self

METHOD SetResolution( nDpi )
// NEW
LOCAL cFarProc
LOCAL uResult
DEFAULT nDpi := 100
if ::lLoad
   cFarProc := GetProcAddress( ::hDLL, "TWAIN_SetResolution",.T., VOID,_DOUBLE )
   uResult  := CallDLL( cFarProc,nDpi )
end
RETU Self

METHOD Set(lShow)
// Show-Hide Scanner's Dialog Box
LOCAL nHide := 0      // Default: Shows Scanner's Dialog Box
LOCAL cFarProc
LOCAL uResult
DEFAULT lShow := .T.
if ::lLoad
   nHide := iif(lShow,0,1)
   cFarProc := GetProcAddress( ::hDLL, "TWAIN_SetHideUI",.T., VOID,_INT )
   uResult  := CallDLL( cFarProc,nHide )
end
RETU Self

METHOD Choose()
// Select Image Device Source
LOCAL cFarProc
LOCAL nResult
if ::lLoad
   cFarProc := GetProcAddress( ::hDLL, "TWAIN_SelectImageSource",.T., _INT,WORD )
   nResult  := CallDLL( cFarProc,::hWnd )
end
RETU Self

//---------- Protected Methods

   METHOD Free(hDib)
   // Release Dib's Handle
   LOCAL cFarProc
   LOCAL uResult
   cFarProc := GetProcAddress( ::hDLL, "TWAIN_FreeNative",.T., VOID,WORD )
   uResult  := CallDLL( cFarProc,hDib )
   RETU NIL

   METHOD DibToFile(hDib,cFile)
   // Write to File From DIB's handle
   LOCAL cFarProc
   LOCAL nResult
   LOCAL lRet
   cFarProc := GetProcAddress( ::hDLL, "TWAIN_WriteNativeToFilename",.T., _INT,WORD,LPSTR)
   lRet     := ( (nResult:=CallDLL( cFarProc,hDib,cFile ))==0 )
   DO CASE
      CASE nResult == -1
         MsgInfo("Annullato dall'utente","File non registrato")
      CASE nResult == -2
         MsgInfo("Errore durante la scrittura sul file "+cFile,"File non registrato")
      CASE nResult == -3
         MsgInfo("Errore interno sul file DIB","File non registrato")
      CASE nResult == -4
         MsgInfo("Errore durante la scrittura sul file "+cFile+", probabile spazio insufficiente sul disco !","File non registrato")
   ENDCASE
   RETU lRet

   METHOD IsActive()
   // Is Twain driver loaded ?
   LOCAL cFarProc
   LOCAL nResult
   cFarProc := GetProcAddress( ::hDLL, "TWAIN_IsAvailable",.T., _INT )
   if ! (nResult    := CallDLL( cFarProc )) == 1
      MsgAlert("Nessun driver per apparecchi TWAIN compatibili risulta disponibile !","Errore hardware")
      // Messaggio inviato direttamente da TWAIN.DLL
   end
   RETU iif(nResult==1,.T.,.F.)

   METHOD Register()
   // Register my application into Twain application
   LOCAL   nMaiorNum := 1
   LOCAL nMinorNum := 0   // Result -> 1.0
   LOCAL nLanguage := 0
   LOCAL nCountry  := 0
   LOCAL cVersion  := "1.0"
   LOCAL cManifact := "The Genius"
   LOCAL cFamily   := "Digitizer"
   LOCAL cProduct := StrTran(cFileName(GetModuleFileName(GetInstance())),".EXE","")
   LOCAL cFarProc
   LOCAL uResult
   cFarProc := GetProcAddress( ::hDLL, "TWAIN_RegisterApp",.T.,;
                           VOID,_INT,_INT,_INT,_INT,LPSTR,LPSTR,LPSTR,LPSTR )
   uResult  := CallDLL( cFarProc,nMaiorNum,nMinorNum,nLanguage,nCountry,cVersion,cManifact,cFamily,cProduct )
   RETU NIL

//---------- END Protected Methods

STATIC FUNCTION BuildError(nError)
LOCAL cRet := "Errore nella libreria dinamica"
DO CASE
   CASE nError == 0
         cRet := "Memoria insufficiente ad eseguire il programma"
   CASE nError == 2
         cRet := "File non trovato"
   CASE nError == 3
         cRet := "Percorso non trovato"
   CASE nError == 5
         cRet := "Tentantivo di collegarsi dinamicamente ad un task o errore di condivisione"
   CASE nError == 6
         cRet := "La libreria richiede un segemento separato per ogni task"
   CASE nError == 8
         cRet := "Memoria insufficiente ad avviare l'applicazione"
   CASE nError == 10
         cRet := "Versione di MS Windows non corretta"
   CASE nError == 11
         cRet := "Libreria non valida oppure non Š un'applicazione MS Windows"
   CASE nError == 12
         cRet := "Applicazione disegnata per un sistema operativo diverso"
   CASE nError == 13
         cRet := "Applicazione disegnata per MS-DOS 4.0"
   CASE nError == 14
         cRet := "Tipo di file eseguibile sconosciuto"
   CASE nError == 15
         cRet := "Tentativo di caricare un'applicazione disegnata per funzionare in modalit… reale"
   CASE nError == 16
         cRet := "Tentativo di caricare una seconda istanza dell'applicazione contenente segmenti di dati multipli non marcati per la sola lettura"
ENDCASE
RETU OemToAnsi( cRet + "!" )



//------------------ Freeimage.dll ------------------------//

FUNCTION SaveImage( cFile )
LOCAL nFormat, hDib, hInfoH, hInfo, hBits, hWnd, hDC, hBmp, lOk

#ifdef __CLIPPER__
    hLib = LOADLIB32( "freeimage.dll" )
#else
    hLib = LOADLIBRARY( "freeimage.dll" )
#endif

    if hLib <= 32
        MsgStop( "Cannot load FreeImage.dll" )
        return 0
    endif

    nFormat := FIGETFILETYPE( cFile, 0 )
    hDib    := FILOAD( nFormat, cFile, 0 )
    hInfoH  := FIGETINFOHEADER( hDib )
    hInfo   := FIGETINFO( hDib )
    hBits   := FIGETBITS( hDib )
    hWnd    := GETDESKTOPWINDOW()

#ifdef __CLIPPER__
    hDC = GETDC32( hWnd )
#else
    hDC = GETDC( hWnd )
#endif

lOk := fiSave( 2 , hDib, cFile )

hBmp = CREATEDIBITMAP( hDC, hInfoH, CBM_INIT, hBits, hInfo, DIB_RGB_COLORS )

#ifdef __CLIPPER__
    RELEASEDC32( hWnd, hDC )
#else
    RELEASEDC( hWnd, hDC )
#endif

FIUNLOAD( hDib )

#ifdef __CLIPPER__
    FREELIB32( hLib )
#else
    FREELIBRARY( hLib )
#endif
RETURN hBmp


DLL32 STATIC FUNCTION FIGETFILETYPE( cFileName AS LPSTR, nSize AS LONG ) AS LONG;
      PASCAL FROM "_FreeImage_GetFileType@8" LIB hLib

DLL32 STATIC FUNCTION FILOAD( nFormat AS LONG, cFileName AS LPSTR, nFlags AS LONG ) AS LONG;
      PASCAL FROM "_FreeImage_Load@12" LIB hLib

DLL32 STATIC FUNCTION FIUNLOAD( hDib AS LONG ) AS VOID;
      PASCAL FROM "_FreeImage_Unload@4" LIB hLib

DLL32 STATIC FUNCTION FIGETINFOHEADER( hDib AS LONG ) AS LONG;
      PASCAL FROM "_FreeImage_GetInfoHeader@4" LIB hLib

DLL32 STATIC FUNCTION FIGETINFO( hDib AS LONG ) AS LONG;
      PASCAL FROM "_FreeImage_GetInfo@4" LIB hLib

DLL32 STATIC FUNCTION FIGETBITS( hDib AS LONG ) AS LONG;
      PASCAL FROM "_FreeImage_GetBits@4" LIB hLib

DLL32 STATIC FUNCTION FISAVE( nFormat AS LONG, hDib AS LONG, cFileName AS LPSTR, nFlags AS LONG ) AS BOOL;
      PASCAL FROM "_FreeImage_Save@16" LIB hLib
     
DLL32 STATIC FUNCTION FIROTATE( hDib AS LONG, nAngle AS _DOUBLE ) AS LONG;
      PASCAL FROM "_FreeImage_RotateClassic@12" LIB hLib

DLL32 STATIC FUNCTION GETDC32( hWnd AS LONG ) AS LONG;
      PASCAL FROM "GetDC" LIB "user32.dll"

DLL32 STATIC FUNCTION RELEASEDC32( hWnd AS LONG ) AS LONG;
      PASCAL FROM "ReleaseDC" LIB "user32.dll"

DLL32 STATIC FUNCTION CREATEDIBITMAP( hDC AS LONG, hInfoH AS LONG, nFlags AS LONG, hBits AS LONG, hInfo AS LONG, nUsage AS LONG ) AS LONG;
      PASCAL FROM "CreateDIBitmap" LIB "gdi32.dll"

DLL32 FUNCTION WOWHANDLE16( nHandle AS LONG, nHandleType AS LONG ) AS LONG;
      PASCAL FROM "WOWHandle16" LIB "wow32.dll"
User avatar
dutch
 
Posts: 1543
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Postby George » Sat Apr 19, 2008 8:38 pm

Dutch,

Thanks for your fast response. I am using this same code, from L. Gadaleta, without problem; but I would like to try the Rafa Carmona TSCAN.PRG class.
The problem with Rafa Carmona TSCAN.PRG class is in the C wrappers and I don't know how to solved it.

Regards,

George
George
 
Posts: 725
Joined: Tue Oct 18, 2005 6:49 pm

Postby dutch » Sun Apr 20, 2008 3:47 am

Dear George,

I'm sorry. I don't look in it.

Regards,
Dutch
User avatar
dutch
 
Posts: 1543
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Postby thefull » Sat Jun 14, 2008 9:39 pm

dutch wrote:Dear George,

I'm sorry. I don't look in it.

Regards,
Dutch


Sorry , I not view this message.
You only have convert .DLL a .lib.

// For create library, twain.lib : IMPLIB -a -f twain.lib EZTW32.dll

You have link twain.lib in your .bat

Regards.
Rafa Carmona
User avatar
thefull
 
Posts: 731
Joined: Fri Oct 07, 2005 7:42 am
Location: Barcelona


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 48 guests