Jump to content
Dave Nottage

DelphiTwain on 64-bit

Recommended Posts

Has anyone managed to make DelphiTwain:

 

  http://www.kluug.net/delphitwain.php

 

work on 64-bit? The code loads the Twain DLL OK (TWAINDSM.DLL), however for me it fails in the LoadSourceManager routine:

 

FTwainProc(Info, nil, DG_CONTROL, DAT_PARENT, MSG_OPENDSM, @FVirtualWindow)

 

Which returns a result of TWRC_FAILURE. The corresponding condition code is TWCC_BADVALUE

Share this post


Link to post

You followed the instructions for 64 bit compilers, made the necessary change to the code outlined on the page you linked, obtained 64 bit drivers etc?

Share this post


Link to post
16 hours ago, David Heffernan said:

You followed the instructions for 64 bit compilers, made the necessary change to the code outlined on the page you linked, obtained 64 bit drivers etc?

Yes, since as I said, it loads the driver OK. The problem comes after that

Share this post


Link to post
Posted (edited)

Even so, is TWINDSM.DLL you're using also 64-bits? (Is this the place to get current ones?)

Edited by stijnsanders

Share this post


Link to post
On 6/15/2019 at 6:38 AM, stijnsanders said:

Even so, is TWINDSM.DLL you're using also 64-bits?

Yes, TWAINDSM.DLL is 64 bits.

 

On 6/15/2019 at 6:38 AM, stijnsanders said:

(Is this the place to get current ones?)

From here:  https://github.com/twain/twain-dsm/tree/master/Releases/dsm_020402/windows/64

 

Though I've now tried those from the link you gave, with the same result.

 

In case anyone asks: I have already also verified that the correct DLL is being loaded by using GetModuleName for the handle returned.

 

 

Share this post


Link to post
On 6/13/2019 at 9:03 AM, Dave Nottage said:

Which returns a result of TWRC_FAILURE. The corresponding condition code is TWCC_BADVALUE

So you provided a "bad value" :classic_blink:

 

Here it works fine with VueScan as 64 bit scan-sourcedriver.

 

What/which scannerdriver did you try/use?

 

Share this post


Link to post
10 hours ago, rvk said:

What/which scannerdriver did you try/use?

It works for Win32, and reports the following sources:

 

Brother DS-620

WIA-Apple iPhone (my iPhone)

WIA-Galaxy Tab Active2 (an Android device connected to the computer)

 

For Win64, it errors, as per my original post

 

Share this post


Link to post
Posted (edited)

On 64 bit it worked for me but I did't have any scan-sources.

WIA sources are 32-bit and not visible in 64 bit for me.

Installing the VueScan gave me a 64 bit source.

 

What Delphi version do you use?

Are you using VLC of FMX?

Did you try the DelphiTwain\examples\VCL2\DelphiTwainDemo2 example? (which worked for me on 64 bit)

 

Edited by rvk

Share this post


Link to post

Delphi Rio 10.3.1, VCL.

 

I was having problems with refactored code based on the original. I went back to the very original code and managed to make it work, so something must have gone awry in the refactor.

 

Next time it is refactored there'll be incremental testing 🙂

 

Next issue is: when it is used in a DLL, the app locks up after the scan has completed.

Share this post


Link to post
4 hours ago, Dave Nottage said:

Next issue is: when it is used in a DLL, the app locks up after the scan has completed.

Hard to say what could be the cause without example-source of DLL and calling procedure.

 

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×