twain / twain-cs

A C# interface for TWAIN
165 stars 66 forks source link

Using Toolkit Image Transfer Causes SEQERR #30

Closed mattzirkle closed 5 years ago

mattzirkle commented 6 years ago

I have done a lot of debugging of TWAINWorkingGroupToolkit.TWAINCSToolkit::ScanCallback. No matter what I did in my custom form or using the sample applications, I always would get a SEQERR. For native image transfer, it would call into ScanCallback at these places:

Looking at the TWAIN 2.4 Specification on page 3-20, the DG_IMAGE / DAT_IMAGEINFO / MSG_GET and DG_IMAGE / DAT_IMAGELAYOUT / MSG_GET should only get called in TWAIN State 6 before the image transfer. However, looking at ScanCallback, it appears that this is always attempting to happen after the image transfer, which is causing the SEQERR.

I'm not sure how long this has been an issue, but it basically causes the toolkit to not be usable at all, making C# developers use the TWAINWorkingGroup.TWAIN class. This is probably okay in the long-run for developers, but it is extremely frustrating when trying to figure out the finer parts of TWAIN and when stuff should happen.

mattzirkle commented 5 years ago

I realized there was a bug in my code that was causing my SEQERROR. We also inded up not using the TWAINCSToolkit, but instead used the TWAIN object directly.