twain / twain-cs

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

m_twaincstoolkit.Send method returns BADVALUE [sf#8] #12

Closed kolomiets closed 7 years ago

kolomiets commented 7 years ago

Reported by tanveershahpk on 2014-11-19 05:55 UTC sts = m_twaincstoolkit.Send("DG_CONTROL", "DAT_CAPABILITY", "MSG_SET", ref szCapability, ref szStatus); if (sts != TWAINCSToolkit.STS.SUCCESS)

above line of code is returning the BADVALUE, while scanning is working fine by Twack_32 TOOL

kolomiets commented 7 years ago

Commented by mlmcl on 2014-11-20 13:21 UTC Bad value typically indicates an error in the construction of the data being sent to the TWAIN driver. Presumably there's a difference in the way the data is being sent in TWACKER vs TWAIN CS.

The easiest way to figure this out is to run the TWAIN CS Test application provided in this project. The tool will automatically guide you through the steps to discover your device. You need to manually enter MSG_OPENDS when you've selected your desired driver. Once it's open send DG_CONTROL / DAT_CAPABILITY / MSG_GETCURRENT with the capability you want to work with entered into the text box on the middle right side of the application. You should get a CSV string back that shows the format you need to use. The last value in the string is the value of the capability and is numerical (you can look it up to make sure it matches the constant you want).

If you change from MSG_GETCURRENT to MSG_SET, you can then verify that you can set the capability with your desired value. The format of the CSV string is what you need to send in the szCapability in your code.

I hope this helps...

kolomiets commented 7 years ago

Updated by mlmcl on 2015-03-14 15:30 UTC

kolomiets commented 7 years ago

Commented by mlmcl on 2015-03-14 15:30 UTC Unfortunately there's insufficient info to try to make any changes. I won't call it closed, so it's going into wont-fix...