Win7 + EZTW32.DLL problem?

Win7 + EZTW32.DLL problem?

Postby dutch » Wed Aug 18, 2010 4:44 am

Dear All,

I've use EZTW32.DLL + TScanner (The full classes) with WinXP for many years but after change OS to Win7. It doesn't works anymore. When I select source from the computer, it doesn't show anything.

Who has solved this problem or got another solution?

Thanks a lot for any help.
Regards,
Dutch

FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
User avatar
dutch
 
Posts: 1543
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: Win7 + EZTW32.DLL problem?

Postby vensanto » Wed Aug 18, 2010 7:57 am

Hello Dutch

i use this class with windows 7 without problem

--------------

#include "FiveWin.ch"

#define TWAIN_DLL "EZTW32.DLL"

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)
::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 )
Return Self
Endif
IF ( ::lLoad := ::IsActive() )
::Register()
Endif
Return Self


METHOD End()
IF ::hDib != 0
::Free( ::hDib )
Endif
FreeLibrary( ::hDll )
Return .T.


METHOD DigiToFile(cFILE,nRES)
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
Else
::DibToFile(::hDib,cFile)
::Free( ::hDib )
Endif
Endif
Return Self


METHOD DigiToClip(nRES)
LOCAL nPixType := 0
LOCAL cFarProc
LOCAL nResult
DEFAULT nRes := 100

::SetResolution( nRes )

IF ::lLoad
cFarProc := GetProcAddress( ::hDLL, "TWAIN_AcquireToClipBoard",.T., _INT,WORD,_INT )
nResult := CallDLL( cFarProc,::hWnd,nPixType )
Endif
Return Self


METHOD SetResolution( nDpi )
LOCAL cFarProc
LOCAL uResult
DEFAULT nDpi := 100

IF ::lLoad
cFarProc := GetProcAddress( ::hDLL, "TWAIN_SetResolution",.T., VOID,_DOUBLE )
uResult := CallDLL( cFarProc,nDpi )
Endif
Return Self


METHOD Set(lShow)
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 )
Endif
Return uResult


METHOD Choose()
LOCAL cFarProc
LOCAL nResult
IF ::lLoad
cFarProc := GetProcAddress( ::hDLL, "TWAIN_SelectImageSource",.T., _INT,WORD )
nResult := CallDLL( cFarProc,::hWnd )
Endif
Return nResult


//-----------------------------------------

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


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


// Write to File From DIB's handle
METHOD DibToFile(hDib,cFile)
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
Return lRet


// Is Twain driver loaded ?
METHOD IsActive()
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
Endif
Return IIF(nResult==1,.T.,.F.)


// Register my application into Twain application
METHOD Register()
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 )
Return 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
Return OemToAnsi( cRet + "!" )


//Declare Function TWAIN_AcquireToClipboard Lib "EZTW32.DLL" Alias "TWAIN_AcquireToClipboard" _
// ( ByVal hwndApp as Long, ByVal wPixTypes as Dword ) as Long

DLL32 FUNCTION TWAIN_AcquireToClipboard (hwndApp As LONG, wPixTypes as CHAR );
AS LONG PASCAL FROM TWAIN_AcquireToClipboard Lib "EZTW32.DLL"

/*
' Like AcquireNative, but puts the resulting image, if any, into the system
' clipboard. Under Windows, this will put a CF_DIB item in the clipboard
' if successful. If this call fails, the clipboard is either empty or
' contains the old contents.
' A return value of 1 indicates success, 0 indicates failure.
'
' Useful for environments like Visual Basic where it is hard to make direct
' use of a DIB handle. In fact, TWAIN_AcquireToClipboard uses
' TWAIN_AcquireNative for all the hard work.
*/
User avatar
vensanto
 
Posts: 58
Joined: Thu Oct 13, 2005 1:26 pm
Location: ITALIA

Re: Win7 + EZTW32.DLL problem?

Postby vensanto » Wed Aug 18, 2010 8:01 am

************************* // Acquisisce Immagine da Scanner
Function PDF_SCAN(nPROT)
Local nPDF:=PRG_PDF+"PRT"+StrTran(TRANSFORM(nPROT,"99999")," ","0")+".PDF"
Local oScanner,oIMG,nRES:=100
Local nFILE,nCONTA:=1
Local hPDF,K,nOK

AEVAL(DIRECTORY("T_*.BMP"),{|X|FERASE(X[1])})
IF FILE("scanner.txt")
FERASE("scanner.txt")
Endif

DO WHILE .T.
nFILE:="T_"+StrTran(TRANSFORM(nCONTA,"99999")," ","0")+".BMP"

oScanner:=Scanner():New()
IF nCONTA==1
IF oScanner:Choose() == 1
oScanner:Set(.T.)
oScanner:DigiToFile(nFILE,nRES)
Endif
Else
oScanner:Set(.T.)
oScanner:DigiToFile(nFILE,nRES)
Endif
oScanner:End()

IF !FILE(nFILE)
Return .f.
Endif

IF MSGYESNO("SCANNERIZZARE UN'ALTRA PAGINA ?",PRG_TIT)
nCONTA++
LOOP
Else
EXIT
Endif
ENDDO

IF FILE( "T_"+StrTran(TRANSFORM(1,"99999")," ","0")+".BMP" )
DIRMAKE(PRG_PDF)

hPDF:=FCREATE("scanner.txt")
FOR K:=1 TO nCONTA
FWRITE(hPDF,"T_"+StrTran(TRANSFORM(K,"99999")," ","0")+".BMP"+CHR(13)+CHR(10))
NEXT K
FCLOSE(hPDF)

* nOK:=WINEXEC("NCONVERT.EXE -quiet -multi -out pdf -c 5 -o "+nPDF+" -l scanner.txt" ,0 )
MSGRUN("TITOLO","Creazione PDF in corso ...",{|| WAITRUN("NCONVERT.EXE -quiet -multi -out pdf -c 5 -o "+nPDF+" -l scanner.txt" ,0 ) })
Endif

IF FILE(nPDF)
AEVAL(DIRECTORY("T_*.BMP"),{|X|FERASE(X[1])})
IF FILE("scanner.txt")
FERASE("scanner.txt")
Endif
MSGINFO("DOCUMENTI SALVATI !",PRG_TIT)
ShellExecute(0,"open",nPDF)
Endif
Return .T.
User avatar
vensanto
 
Posts: 58
Joined: Thu Oct 13, 2005 1:26 pm
Location: ITALIA

Re: Win7 + EZTW32.DLL problem?

Postby dutch » Wed Aug 18, 2010 8:37 am

Dear Vensanto,

I try your class but it shows an runtime error. while I call SCANNER class.
I add this below code before call SCANNER classes but it will error at line

oScanner := Scanner():New(hWnd) <---- error

May I ask you some questions,
- What's EZTW32.DLL (from DOSADI classic updated version)?
- Do I need to link any library?
- Does my code problem?

Thank you for your kindness.
Code: Select all  Expand view  RUN
FUNCTION Main(cFileRes)
LOCAL cFile, nRes, n

Default cFileRes := 'TESTSCAN.JPG'

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
Msginfo('ok')
oScanner := Scanner():New(hWnd)
DEFAULT nRes := 75                                     // Scanner resolution in Dpi

   oScanner:Choose()

   oScanner:DigiToFile(cFile,nRes)                         // Acquires
    
   oScanner:End()
   oWnd:End()
RETURN NIL
 
Regards,
Dutch

FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
User avatar
dutch
 
Posts: 1543
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: Win7 + EZTW32.DLL problem?

Postby vensanto » Wed Aug 18, 2010 9:31 am

Hello Dutch

send me a e-mail to vensanto@tiscali.it

i send you the file eztwain.dll

Regards
User avatar
vensanto
 
Posts: 58
Joined: Thu Oct 13, 2005 1:26 pm
Location: ITALIA

Re: Win7 + EZTW32.DLL problem?

Postby dutch » Wed Aug 18, 2010 9:04 pm

Here is my problem, I cannot find any device. My laptop has built in webcam. It works in WindXP but not for Win7.

Image
Thanks,
Regards,
Dutch

FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
User avatar
dutch
 
Posts: 1543
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: Win7 + EZTW32.DLL problem?

Postby James Bott » Thu Aug 19, 2010 4:14 pm

I think the Twain driver has to be registered. I don't know how to do this. Try googling it.

Regards,
James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: Win7 + EZTW32.DLL problem?

Postby dutch » Sat Aug 21, 2010 11:45 pm

Dear James & Vensanto,

Thanks a lot, I will try with a brand new Win7 laptop (reformat) and check what happen.
Regards,
Dutch

FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
User avatar
dutch
 
Posts: 1543
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: Win7 + EZTW32.DLL problem?

Postby Marco Turco » Sun Aug 22, 2010 10:15 am

Hi Dutch,
did you download the last eztwain dll from dosadi.com ?
Best Regards,

Marco Turco
SOFTWARE XP LLP
User avatar
Marco Turco
 
Posts: 858
Joined: Fri Oct 07, 2005 12:00 pm
Location: London

Re: Win7 + EZTW32.DLL problem?

Postby dutch » Sun Aug 22, 2010 11:29 am

Dear Marco,

I've downloaded but it's still as the above image. If you have worked with Win7, could you give me an example with DLL file to test in my laptop. Because I got the latest eztw32.dll from dosadi.com. Do I need to by Pro. version?

Thanks,
Marco Turco wrote:Hi Dutch,
did you download the last eztwain dll from dosadi.com ?
Regards,
Dutch

FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
User avatar
dutch
 
Posts: 1543
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: Win7 + EZTW32.DLL problem?

Postby James Bott » Sun Aug 22, 2010 7:10 pm

Dutch,

As I said before, I think you need to register the DLL with the Windows registry. Otherwise Windows doesn't know about it to show it as available.

Search the forum or Google for how to do this.

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: Win7 + EZTW32.DLL problem?

Postby Rick Lipkin » Sun Aug 22, 2010 8:29 pm

Here is how to register a .dll with Windows :

Copy eztw32.dll to your %SystemRoot%\system32 ( windows\system32 ) then programatically you can register the .dll like this :


Code: Select all  Expand view  RUN

cSYSDIR := GetSysDir()       // C:\WINDOWS\SYSTEM32

// register the file //

cREG := "REGSVR32 "+cSYSDIR+"\EZTW32.DLL /S"
WAITRUN( cREG,1 )

 


or you can do it the old fashon way thru a command prompt

copy your file to c:\windows\system32
cd c:\windows\system32

regsvr32 eztw32.dll

The /s switch will not echo the output to the screen

Rick Lipkin
User avatar
Rick Lipkin
 
Posts: 2666
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: Win7 + EZTW32.DLL problem?

Postby dutch » Mon Aug 23, 2010 4:29 am

Dear James & Rick,

I try with the new laptop (Reformat) with Win7 and register Dll.
1.) The Scanner class with EZTW32.DLL can see the Scanner Device as usual and work fine now.
2.) EZTW32.DLL is able to see internal Webcam in laptop when choose the device (WinXp) but It cannot see in Win7 anymore.

The result of EZTW32.DLL + Win7 is working with SCANNER only and not working with WEBCAM (Internal) anymore.

Can the EZTW32.DLL+Win7 work with Webcam?

Thanks you very much for all your kindness help.
Regards,
Dutch

FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
User avatar
dutch
 
Posts: 1543
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: Win7 + EZTW32.DLL problem?

Postby Marco Turco » Mon Aug 23, 2010 3:43 pm

Hi Duch,
I'm using the Pro version for license purpose and it works with Windows 7 64 and 32 bit,
perhaps the "free" version dll is not updated to support this last Os.

You don't need to register the dll, simply copy the dll into your app dir.

I suggest you to download the 30 days pro version from http://www.dosadi.com/eztwain3.htm and install it.
It contains a simply scanner application that use the Dosadi Dlls called Twerp32 and also Twister that report your scanner features. Take a look if Twerp32 runs into your computer, if affermative perhaps there is a problem in the free dll.
Best Regards,

Marco Turco
SOFTWARE XP LLP
User avatar
Marco Turco
 
Posts: 858
Joined: Fri Oct 07, 2005 12:00 pm
Location: London

Re: Win7 + EZTW32.DLL problem?

Postby dutch » Tue Aug 24, 2010 9:24 am

Dear Marco,

I've got the problem now (guess).
Win7 is not show webcam device in MyComputer as WinXp. Now Win7 cannot use Webcam independently anymore that why EZTW32.DLL cannot find Webcam device. Win7 cannot find too. It must fix by let Win7 to see Webcam prior anything.
Marco Turco wrote:Hi Duch,
I'm using the Pro version for license purpose and it works with Windows 7 64 and 32 bit,
perhaps the "free" version dll is not updated to support this last Os.

You don't need to register the dll, simply copy the dll into your app dir.

I suggest you to download the 30 days pro version from http://www.dosadi.com/eztwain3.htm and install it.
It contains a simply scanner application that use the Dosadi Dlls called Twerp32 and also Twister that report your scanner features. Take a look if Twerp32 runs into your computer, if affermative perhaps there is a problem in the free dll.
Regards,
Dutch

FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
User avatar
dutch
 
Posts: 1543
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 67 guests