Home › Forums › TWAIN Classic › BADPROTOCOL error for EnableDSUI
- This topic has 1 reply, 1 voice, and was last updated 5 years, 11 months ago by MarkM.
- AuthorPosts
- Nithya Gnanasekar
Hi,
We are using TwainDSM through DLLImport for Scanning feature in our .Net application. We provided option for user to change their Scanner Settings by calling EnableDSUI. Most of the scanners are working fine whereas some throwing BADPROTOCOL condition code for ENABLEDSUI. We are not sure whether any scanner settings or proficiency of the scanner restricting it.
Please help us with this issue.
Thanks in advance.
MarkMI assume that you’re doing something like the following:
[DllImport(“twaindsm.dll”, EntryPoint = “DSM_Entry”, CharSet = CharSet.Ansi)]
internal static extern UInt16 WindowsTwaindsmDsmEntryUserinterface
(
ref TWAIN.TW_IDENTITY_LEGACY origin,
ref TWAIN.TW_IDENTITY_LEGACY dest,
TWAIN.DG dg,
TWAIN.DAT dat,
TWAIN.MSG msg,
ref TWAIN.TW_USERINTERFACE twuserinterface
);With the appropriate structures specified, and that the arguments are DG_CONTROL, DAT_USERINTERFACE, and MSG_ENABLEDS.
If these are followed a driver shouldn’t throw TWCC_BADPROTOCOL, since this operation is mandatory for all TWAIN drivers. The first thing to do is download a tool, like TWACKER and determine if the driver really can’t do this operation. If so, then you’ll have to contact the scanner vendor for more help.
If the driver does work, then I recommend debugging with the open source TWAINDSM. This can be downloaded from the TWAIN Working Group’s github. And will allow you to track the progress of the command to the point where it’s ready to call the TWAIN driver, confirming that all of the arguments are correct, and were correctly marshaled by C# into the unmanaged C++ code.
- AuthorPosts