Recent

Author Topic: Call to Delphi Twain  (Read 5464 times)

polpero

  • Full Member
  • ***
  • Posts: 116
Call to Delphi Twain
« on: May 17, 2019, 10:34:52 pm »
Hi

I had a small program using  Kluug's Delphi Twain that worked in Laz 1.8 and wont call the Twain Acquire window anymore in 2.02... It may have nothing to do with Lazarus but rather with Windows 10 although the Delphi 7 version works fine...

has anyone else swam in those waters?

jamie

  • Hero Member
  • *****
  • Posts: 6090
Re: Call to Delphi Twain
« Reply #1 on: May 17, 2019, 10:43:03 pm »
I just recently put in a twain UNIT I got somewhere from the net using 2.0.2 in a project, it seems to work for me..

Are you sure you didn't install the 64 bit laz ? there may be no 64 bit drivers installed.
The only true wisdom is knowing you know nothing

polpero

  • Full Member
  • ***
  • Posts: 116
Re: Call to Delphi Twain
« Reply #2 on: May 18, 2019, 02:25:43 am »
Thanks Jamie

you were right
i was stuck with an old copy of attempts to run it in 64bits
and a few major events weren't assigned...

my mistake

jamie

  • Hero Member
  • *****
  • Posts: 6090
Re: Call to Delphi Twain
« Reply #3 on: May 19, 2019, 08:05:41 pm »
I don't know if this is just coincidence or what ever, but I just tried out one of my other apps that has Twain support for it
, did a complete recompile because I was modifying some buttons and noticed my twain does not work anymore.

  I don't have any supported devices installed in this PC but the default test device should appear and it does not.

 The only other thing I can think of is I just had a windows update prior to doing this..

  it fails doing the EnumerateDeviceList, the dummy twain isn't coming back..

 I suppose I could install a scanner to test this..
The only true wisdom is knowing you know nothing

polpero

  • Full Member
  • ***
  • Posts: 116
Re: Call to Delphi Twain
« Reply #4 on: May 20, 2019, 01:17:34 am »
Strange...

My program is up and running fine... using the Kluug's version:

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

maybe you could check it?



jamie

  • Hero Member
  • *****
  • Posts: 6090
Re: Call to Delphi Twain
« Reply #5 on: May 20, 2019, 03:41:57 am »
The code I am using is just about the same.. it worked before but I just had a windows update and it must of removed
or messed up the fake device that normally gets installed..

 It all works if I skip the check point when it enumerates devices, the dialog will comeup etc...

 but it looks like I now have no devices that are showing since the windows update.

 I'll have to install a flatbed scanner to see what happens..
 
 Thanks.
The only true wisdom is knowing you know nothing

CM630

  • Hero Member
  • *****
  • Posts: 1081
  • Не съм сигурен, че те разбирам.
    • http://sourceforge.net/u/cm630/profile/
Re: Call to Delphi Twain
« Reply #6 on: September 17, 2020, 01:18:44 pm »
There is some bug in this, but I cannot fix it- the Product Name are truncated.
There is sth. wrong in Structure.ProductName from DelphiTwain.pas.
Лазар 3,2 32 bit (sometimes 64 bit); FPC3,2,2; rev: Lazarus_3_0 on Win10 64bit.

rvk

  • Hero Member
  • *****
  • Posts: 6110
Re: Call to Delphi Twain
« Reply #7 on: September 17, 2020, 02:15:25 pm »
There is some bug in this, but I cannot fix it- the Product Name are truncated.
There is sth. wrong in Structure.ProductName from DelphiTwain.pas.
Are you sure that's a bug?
From the Twain documentation:
Code: Pascal  [Select][+][-]
  1. typedef unsigned char TW_STR32[34], FAR *pTW_STR32;
So ProductName (and Manufacturer and ProductFamily) are all limited to 34 characters.

On how many characters is it truncated for you??

CM630

  • Hero Member
  • *****
  • Posts: 1081
  • Не съм сигурен, че те разбирам.
    • http://sourceforge.net/u/cm630/profile/
Re: Call to Delphi Twain
« Reply #8 on: September 17, 2020, 07:44:06 pm »
On how many characters is it truncated for you??
The image answers better:

Лазар 3,2 32 bit (sometimes 64 bit); FPC3,2,2; rev: Lazarus_3_0 on Win10 64bit.

rvk

  • Hero Member
  • *****
  • Posts: 6110
Re: Call to Delphi Twain
« Reply #9 on: September 17, 2020, 08:29:53 pm »
On how many characters is it truncated for you??
The image answers better:
Twain standard 2.2 is 34 characters.
https://www.twain.org/wp-content/uploads/2016/03/TWAIN-2.2-Spec.pdf
and the latest 2.4 too
https://www.twain.org/wp-content/uploads/2017/03/TWAIN-2.4-Specification.pdf

The TW- in your image seems to be truncated at 27. (Edit: not truncated but has version and bitness after it)
The WIA seems to be correctly truncated at 34.

Not sure if those other selection screens really use the Twain standard.

Edit: Actually... looking at the other Select source image... they are truncated TOO !!!!
But they have a driver version after them and an indication for 32 bit (32-32)
So all Select source samples are the same for the ProductName.

The Select source screen itself comes from the Twain driver so I'm not sure which flags should be added to get the version and (32-32) to show for you too.

Edit #2: Again. Last correction.
For DelphiTwain the Select Source is custom.
It is called TDelphiTwain.CustomSelectSource()
In there you can add the version-number and bitness.
I'm not sure how to call the standard Select Source from Twain itself (but there must be a way).
« Last Edit: September 17, 2020, 09:52:35 pm by rvk »

jamie

  • Hero Member
  • *****
  • Posts: 6090
Re: Call to Delphi Twain
« Reply #10 on: September 17, 2020, 11:42:02 pm »
I got my app to work with DelphiTwain. I guess I could look at it to see what it was I did..
The only true wisdom is knowing you know nothing

CM630

  • Hero Member
  • *****
  • Posts: 1081
  • Не съм сигурен, че те разбирам.
    • http://sourceforge.net/u/cm630/profile/
Re: Call to Delphi Twain
« Reply #11 on: September 18, 2020, 07:58:17 am »

Edit #2: Again. Last correction.
For DelphiTwain the Select Source is custom.
It is called TDelphiTwain.CustomSelectSource()
In there you can add the version-number and bitness.
I'm not sure how to call the standard Select Source from Twain itself (but there must be a way).
Thanks, I will try to do sth in that diretion.

Quote from: jamie
I got my app to work with DelphiTwain. I guess I could look at it to see what it was I did..
No need to check, software itself works, only the indicated value in the selec twain dialog are odd.
Лазар 3,2 32 bit (sometimes 64 bit); FPC3,2,2; rev: Lazarus_3_0 on Win10 64bit.

jamie

  • Hero Member
  • *****
  • Posts: 6090
Re: Call to Delphi Twain
« Reply #12 on: September 18, 2020, 01:24:59 pm »
U don't need to use the dialog to select the device.
The list can be gotten from the properties. From there u can display it as u wish.
The only true wisdom is knowing you know nothing

rvk

  • Hero Member
  • *****
  • Posts: 6110
Re: Call to Delphi Twain
« Reply #13 on: September 18, 2020, 01:36:32 pm »
U don't need to use the dialog to select the device.
The list can be gotten from the properties. From there u can display it as u wish.
Like DelphiTwain itself does with TDelphiTwain.CustomSelectSource()  :D

jamie

  • Hero Member
  • *****
  • Posts: 6090
Re: Call to Delphi Twain
« Reply #14 on: September 18, 2020, 10:40:03 pm »
As we were talking about this last night, I was testing a page scan into an app I have and it kept scanning a blank image but at the size I cropped.

 The moral of the story is, don't believe what your scanner tells you it has already sitting on the surface because it could be showing you the last image it scanned.

 Its always a good idea to make sure you actually have a document sitting on the scan surface because the scanners can lie to you!  >:(
The only true wisdom is knowing you know nothing

 

TinyPortal © 2005-2018