πŸš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.databases.visual-dbase
4 messages
4 total messages Started by Ruediger Spindler Sun, 21 Dec 1997 00:00
vdbase 5.5 and EZTWAIN
#18
Author: Ruediger Spindler
Date: Sun, 21 Dec 1997 00:00
38 lines
2004 bytes
Hello all vdbase programmers,
I try to access a TWAIN-compatible scanner from vdbase 5.5, using the
EXTERNal DLL EZTWAIN 1.06 and 1.07, but getting problems by passing
the filename to one of it's functions. All other functions are working
well.
The code I tried:

*******************************************************************************

EXTERN CINT TWAIN_AcquireToFilename( CHANDLE, CSTRING ) EZTWAIN.DLL
EXTERN CINT MessageBox( CHANDLE, CSTRING, CSTRING, CWORD) USER.EXE

      tempfile = "SCANTEMP.BMP"
      MessageBox( 0, "This file will be created", tempfile, 0 )
      scanres = TWAIN_AcquireToFilename( 0, tempfile )
      if scanres > 0                              && (will always fail
with -2 = illegal filename)
*******************************************************************************

Visual dBASE uses:
 - pascal calling convention
 - 16bit DLLs only
 - CHANDLE = 16bit WORD
 - CSTRING = zero terminated char far *
So everything should be OK...

The problem on this:
The external Windows DLL-Func "MessageBox" works OK, but the EZTWAIN
DLL-Func "TWAIN_AcquireToFileName" seems to misunderstand the filename
and uses garbage-strings (or NULL or empty) instead and so fails to
create the file...

Has anyone experiences with EZTWAIN.DLL and vdbase and could me give
some hints
how to get this working???
Thanks in advance
Ruediger Spindler
Re: vdbase 5.5 and EZTWAIN
#16
Author: JοΏ½rgen Feder
Date: Mon, 22 Dec 1997 00:00
32 lines
1445 bytes
On Sun, 21 Dec 1997 13:33:21 +0100, Ruediger Spindler
<spindler@on-line.de> wrote:

>Has anyone experiences with EZTWAIN.DLL and vdbase and could me give
>some hints
>how to get this working???

Hi Ruediger,

I did not look through your code, but here is a code- snippet which
works for me:

Procedure Scan_OnClick
PARAM oFormHwnd,cFieldId 
&&cFieldId contains qualifier (BINARY or  OLE)+" "+FieldName
PRIVA TwInt,iResult,FiName
IF TYPE('TWAIN_AcquireNative')<>'FP'
   EXTERN CINT TWAIN_AcquireNative(CINT,CINT) EZTWAIN.DLL
ENDIF
EXTERN CINT TWAIN_WriteNativeToFilename(CINT,CSTRING) EZTWAIN.DLL
EXTERN CINT TWAIN_FreeNative(CINT) EZTWAIN.DLL
FiName='TMP.BMP'
TwInt=TWAIN_AcquireNative(oFormHwnd,0)
iResult=TWAIN_WriteNativeToFilename(TwInt,FiName)
iResult=iResult+TWAIN_FreeNative(TwInt)
IF iResult=0
    REPL &cFieldId. FROM &FiName
    *FORM.IMAGECC.DataSource="FILE "+FiName
ENDIF
RELEASE DLL EZTWAIN.DLL
RETURN
Re: vdbase 5.5 and EZTWAIN
#17
Author: Bowen Moursund
Date: Mon, 22 Dec 1997 00:00
50 lines
2501 bytes

Ruediger Spindler wrote in message <349D0C91.9C60FFAB@on-line.de>...
>Hello all vdbase programmers,
>I try to access a TWAIN-compatible scanner from vdbase 5.5, using the
>EXTERNal DLL EZTWAIN 1.06 and 1.07, but getting problems by passing
>the filename to one of it's functions. All other functions are working
>well.
>The code I tried:
>
>***************************************************************************
****
>
>EXTERN CINT TWAIN_AcquireToFilename( CHANDLE, CSTRING ) EZTWAIN.DLL
>EXTERN CINT MessageBox( CHANDLE, CSTRING, CSTRING, CWORD) USER.EXE
>
>      tempfile = "SCANTEMP.BMP"
>      MessageBox( 0, "This file will be created", tempfile, 0 )
>      scanres = TWAIN_AcquireToFilename( 0, tempfile )
>      if scanres > 0                              && (will always fail
>with -2 = illegal filename)
>***************************************************************************
****
>
>Visual dBASE uses:
> - pascal calling convention
> - 16bit DLLs only
> - CHANDLE = 16bit WORD
> - CSTRING = zero terminated char far *
>So everything should be OK...
>
>The problem on this:
>The external Windows DLL-Func "MessageBox" works OK, but the EZTWAIN
>DLL-Func "TWAIN_AcquireToFileName" seems to misunderstand the filename
>and uses garbage-strings (or NULL or empty) instead and so fails to
>create the file...

You might try prototyping the function like this:

 EXTERN CINT TWAIN_AcquireToFilename( CHANDLE, CPTR ) EZTWAIN.DLL

Append a null to the string parameter:

      tempfile = "SCANTEMP.BMP"+chr(0)
      MessageBox( 0, "This file will be created", tempfile, 0 )
      scanres = TWAIN_AcquireToFilename( 0, tempfile )
____
Bowen Moursund
bowenNOSPAM@nerds.com
http://www.mindspring.com/~bowenm/datatech.htm
Re: vdbase 5.5 and EZTWAIN
#15
Author: Ruediger Spindler
Date: Thu, 25 Dec 1997 00:00
50 lines
2648 bytes
Thanks for all hints...
finally I fixed the problem: it wasn't within my code but is a small bug
within the EZTWAIN.DLL library where the function TWAIN_AcquireToFilename
has a wrong definition using a NEAR pointer to the string instead of using a
FAR pointer. I hope, spike will fix it for the next release...
This bug is only in this one routine so I worked around it by using lower level
functions which are working perfectly alright.
so merry x-mas to all
Ruediger

Ruediger Spindler wrote:

> Hello all vdbase programmers,
> I try to access a TWAIN-compatible scanner from vdbase 5.5, using the
> EXTERNal DLL EZTWAIN 1.06 and 1.07, but getting problems by passing
> the filename to one of it's functions. All other functions are working
> well.
> The code I tried:
>
> *******************************************************************************
>
> EXTERN CINT TWAIN_AcquireToFilename( CHANDLE, CSTRING ) EZTWAIN.DLL
> EXTERN CINT MessageBox( CHANDLE, CSTRING, CSTRING, CWORD) USER.EXE
>
>       tempfile = "SCANTEMP.BMP"
>       MessageBox( 0, "This file will be created", tempfile, 0 )
>       scanres = TWAIN_AcquireToFilename( 0, tempfile )
>       if scanres > 0                              && (will always fail
> with -2 = illegal filename)
> *******************************************************************************
>
> Visual dBASE uses:
>  - pascal calling convention
>  - 16bit DLLs only
>  - CHANDLE = 16bit WORD
>  - CSTRING = zero terminated char far *
> So everything should be OK...
>
> The problem on this:
> The external Windows DLL-Func "MessageBox" works OK, but the EZTWAIN
> DLL-Func "TWAIN_AcquireToFileName" seems to misunderstand the filename
> and uses garbage-strings (or NULL or empty) instead and so fails to
> create the file...
>
> Has anyone experiences with EZTWAIN.DLL and vdbase and could me give
> some hints
> how to get this working???
> Thanks in advance
> Ruediger Spindler
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads