Forum Replies Created
This isn’t a TWAIN question. The final destination of scanned images is 100% under the control of the application, the TWAIN drivers don’t get a say in the matter. This is true for WIA as well.
You need to work with the application to determine what folders are being used. Once you have that info it’s possible to monitor for files being written to folders, though I have to point out that you won’t have any way of knowing when an application is done with a particular image file.
This is Windows behavior. If an application’s message loop is unresponsive to the operating system for more than a certain number of seconds the “(not responding)” message is added to the application’s title bar.
A well designed TWAIN application separates TWAIN calls from the main message loop. A well designed TWAIN driver responds to TWAIN calls as quickly as possible. However, TWAIN calls are blocking by nature, so if a particular operation takes a long time there’s nothing the driver can do about it.
Short answer, this sort of problem can only be fixed in application code…
You should get the 64-bit TWAINDSM.DLL. You can find that here…
This is an open source project maintained by the TWAIN Working Group. It’s 100% compatible with the legacy TWAIN_32.DLL, and improves on it in many ways. Only the application has to point to TWAINDSM.DLL. All drivers should work with it. An application just has to LoadLibrary(“TWAINDSM.DLL”) to use it, no other changes are needed.
Note that you must have a native 64-bit TWAIN driver for this to work. You can find a list of those here…
You need to use native 64-bit TWAIN drivers with native 64-bit applications. Check here for a list of scanners that support native 64-bit…
You’ll have to talk to the folks who wrote and/or maintain pytwain. However, after ss.RequestAcquire() you may only have entered state 5 in the driver. The driver doesn’t go to state 6 until it’s ready to transfer images (indicated by sending MSG_XFERREADY to the application).
While I don’t normally recommend this. One hack would be to loop on rv = ss.XferImageNatively(), as long as you’re getting twain.excTWCC_SEQERROR. That error indicates that you’re still in state 5. When the driver transitions to state 6 you’ll get back some other status, such as TWRC_XFERDONE or TWRC_CANCEL. You’ll need to check for a few different possible returns.
You need a 64-bit TWAIN driver, if you want to run with a 64-bit process. Not all scanner manufacturers support this. If they do, you’ll see their drivers in the C:Windowstwain_64 folder. You can’t just copy those files from 32-bit.
Check out this link for a list of scanners that natively support 64-bit.
http://twain.org/about-twain/devicesFebruary 10, 2016 at 3:24 pm in reply to: Twain Driver not found error when running twaincsscan sample #26358
There are three binaries provided with the demo. Two of them: Any and x64, will run as a 64-bit process, which requires a 64-bit TWAIN driver. On Windows this is located in C:Windowstwain_64…
Use the x86 binary to run using 32-bit TWAIN drivers on both 32-bit and 64-bit Windows systems.December 17, 2015 at 3:50 pm in reply to: Twain 184.108.40.206 function is throwing unknown exception #26337
The TWAIN_32.DLL is effectively “dead code” insofar as it’s not possible to make changes to it, and it’s closed code not open source. It was last modified around the early 2000’s. Using the newer TWAINDSM.DLL is a better solution.
There is a logging mechanism for TWAIN_32.DLL, but it’s very limited, and if a crash is occurring it’s unlikely that it will be able to write the information you want to disk.
Your best bet is to go through each of the steps the application is doing using the TWACKER (you can collect the commands using the TWAINDSM.DLL logging), and when you find the one that’s causing the crash contact the scanner manufacturer or the application writer for more help.December 17, 2015 at 3:10 pm in reply to: Strategy to persist scanner for reuse – no device selection #26341
Your request is a little vague, but based on your WIA example I’m assuming that you’d like to establish the default TWAIN Driver, or at least have programmatic control of which one is opened.
If you control the scanner application the simplest way to do this is to specify the TW_IDENTITY.ProductName when you call DG_CONTROL / DAT_IDENTITY / MSG_OPENDS. You can get this value by enumerating through the available TWAIN drivers using DG_CONTROL / DAT_PARENT / MSG_GETFIRST and DG_CONTROL / DAT_PARENT / MSG_GETNEXT.
It’s also possible to set the default using DG_CONTROL / DAT_IDENTITY / MSG_SETDEFAULT, but this only works with the TWAINDSM.DLL module, and only makes sense if you can’t guarantee control of the applications that will use the scanner.
It sounds like you’ve run into a badly behaving TWAIN Driver. Calls to DG_CONTROL / DAT_PARENT / MSG_GETFIRST and DG_CONTROL / DAT_PARENT / MSG_GETNEXT should only return a status of TWRC_SUCESS or TWRC_ENDOFLIST.
I recommend that you ignore the status and continue enumerating until you find your scanner, or until you reach TWRC_ENDOFLIST.
There is also the ugly possibility that your scanner is reporting TWRC_FAILURE / TWCC_NODS, but still returning valid TW_IDENTITY data, so you might need to check for that too.
If you look in the readme.txt file you should find the following instructions…
– install QT 4.5.3 SDK for windows
– Set environment variable QTDIR and/or QTDIR_64 to qt directory (Ex. QTDIR=C:Qt2009.02qt QTDIR_64=C:Qt2009.02_x64qt)
– QMake is used to generate the makefiles. You can get a copy of this free in any
QT Open Source distribution. Please see http://www.trolltech.com for more info.
– copy the TWAIN_logo.png and TWAINDS_Sample[32|64].ds to /Windows/twain_[32|64]/sample2
– Or use the provided Visual Studio project files.
After you do that the project should build for you…
Check out the TWAIN Sample Data Source and Application…
The sample data source uses quick time imaging libraries wrapped in an object to simulate scanning, you should be able to modify that object to make calls to your DLL to implement scanning and get your own TWAIN data source working.
Can you share the errors you’re seeing?August 4, 2015 at 2:45 pm in reply to: Problem using DG_CONTROL / DAT_CUSTOMDSDATA / MSG_SET #26300
If you try the same thing with a Kodak Document Imaging scanner (running in simulation mode is fine for the test, an i5200 would serve well), you can see if the code works, and if not, I can probably offer some advice. Otherwise your best bet is to contact the vendor directly and see what help they can offer…
The TWAIN Working Group only manages the standard TWAIN capabilities described in the specification. Scanner vendors can add their own custom content, but are responsible for providing documentation and/or header files describing that content. So you’ll have to get in touch with them for more info…