twain / twain-cs

A C# interface for TWAIN
168 stars 67 forks source link

Why this m_twain.DatImageinfo return FAILURE/SEQERROR? #52

Open CapacitorDev opened 1 year ago

CapacitorDev commented 1 year ago

Hi,

I tried to get the twimageinfo on win10 64bit - plustek but couldnt succeed.

m_twain.DatImageinfo(TWAIN.DG.IMAGE, TWAIN.MSG.GET, ref twimageinfo) // It return SEQERROR all the time.

DG_IMAGE/DAT_IMAGEINFO/MSG_GET 0,0,0,0,0,0,0,0,0,0,0,0,0,0,TWPT_BW,TWCP_NONE FAILURE/SEQERROR

any ideas?

Thank yous

mlmcl62 commented 1 year ago

DG_IMAGE/DAT_IMAGEINFO/MSG_GET can only be successful when the TWAIN driver is in state 6 or 7 (7 is better, all of the metadata is guaranteed correct in that state).

DG_CONTROL/DAT_USERINTERFACE/MSG_ENABLEDS with a TW_USERINTERFACE.ShowUI value of 0, is needed to transition from state 4 to state 5.

The driver indicates that it's transitioned to state 6 when it returns DG_CONTROL/DAT_NULL/MSG_XFERREADY to the application, at that point it can issue a DG_IMAGE/DAT_IMAGE*XFER/MSG_GET call to transfer the image data, and then DG_IMAGE/DAT_IMAGEINFO/MSG_GET to get the metadata for the image.