May 20, 2016 at 5:50 am #23058
I have this TWAIN DS that works with my Web Camera. To test it I use two applications given out by TWAIN. The Standard Windows Console based Twain Application (uses TWAINDSM.dll Version 184.108.40.206) using twain.h of version 2.3 and the TWAIN Twacker Application (uses TWAIN_32.dll Version 1.07.1.3) using twain.h of version 2.0 and using ProtocolMajor as 1 and Protocol Minor as 9 in TW_IDENTITY of the Application. I am on Windows 64 bit windows 8 but using
When I use the Twacker Application by using the following settings
1. TWAIN 2.0 -> Unselected.
2. SHOWUI -> Unselected.
3. Memory (Transfer Mode).
I am able to capture the image. During the call to DSMEntry with DG_IMAGE, DAT_IMAGEINFO, MSG_GET the TW_IMAGEINFO has ImageWidth to 640 and ImageHeight to 480 (might be the default values as I did not GET/SET any capabilities for the device).
Now begins the problem, when I use the same configuration and use the Console Application (which I build from the source) it is unable to capture the image and crashes. The reason behind this is that the call with DG_IMAGE, DAT_IMAGEINFO, MSG_GET return the TW_IMAGEINFO with ImageWidth and ImageHeight set to 0. Then, I set the ShowUI to TRUE in TW_USERINTERFACE structure during the call with DG_CONTROL, DAT_USERINTERFACE, MSG_ENABLEDS. During capture, I got the UI and was able to capture the image got the proper ImageWidth and ImageHeight.
I need to create an Application that can scan documents using TWAIN. Now I am confused as whether to go according to 2.3 specifications or 1.9? As one can capture from my camera and other does not using the same setting.
Any advice on this would be highly appreciated. As I don’t want to hit a roadblock later in the code.
Best RegardsAugust 17, 2016 at 5:30 pm #26386
DAT_IMAGEINFO must be called in state 7 after TWRC_XFERDONE is returned by one of the DAT_IMAGE*XFER calls. Anything prior to that is not required to return complete or correct information.
TWAIN is forward and backwards compatible, there are some changes that occur with the versions (especially going from 1.9 to 2.0), but in most cases these can be ignore on the application side. The TWAIN Spec tries to call all of these out in one chapter.