Open Dialecticus opened 4 years ago
Hi. I've looked at the log and the code. I temporarily modified the code to force a value of TRUE for ShowUI, because that code path isn't regularly tested (if a scanner supports DAT_CUSTOMDSDATA it's not needed).
As noted the call to DAT_USERINTERFACE is returning TWRC_FAILURE. It's also not filling in the condition code, returning a value of 65536. The fact that it takes the driver 11 seconds to return the error seems like a long time.
I'm afraid that this is going to be on the driver behaving badly. However, it may be worth trying something. The twaincstst program has a checkbox that switches it to use the old TWAIN_32.DLL. I have yet to run into a driver that has a problem with TWAINDSM.DLL, but there's a first time for everything. You should be able to run that program, select the legacy DSM, and then click your way through the 'Send' button. When you see your scanner listed in the bottom text window change to DG_CONTROL / DAT_IDENTITY / MSG_OPENDS, and Send to open it. When it's open change to DG_CONTROL / DAT_USERINTERFACE / MSG_ENABLEDS and enter TRUE,FALSE,0 in the window on the right, and Send to bring the user interface up.
If the call still returns TWRC_FAILURE, then I'm not sure I have any other ideas. You could try contacting the scanner vendor to see if they can help. If that does work, let me know, and I can make a change to the app that'll let you select the DSM to use.
I think the legacy driver is the key. The user interface is not up in twaincstst after the steps below, but I can complete the scan in twaincsscan when I replace false with true in twaincsscan\source\FormScan.cs(104). The scan is slanted at 45 degrees, though, but that's a different issue I guess.
DG_CONTROL/DAT_PARENT/MSG_OPENDSM: SUCCESS
527106
DG_CONTROL/DAT_IDENTITY/MSG_GETFIRST: SUCCESS
146,1,0,ENG,USA,1.0,1,9,0x3,Hewlett-Packard,HP LJ M1530 Scan,HP LJ M1530 Scan TWAIN
DG_CONTROL/DAT_USERINTERFACE/MSG_ENABLEDS: BADDEST
TRUE,FALSE,0
Can't use demo project for scanning. Windows Scan from Micorosft Store and Twacker can use my HP LJ M1530 Scan scanner/printer, but TWAINCSScan produces log file below. Driver's GUI is shown, and I can initiate scanning, but when I click on Done (in driver's GUI) method NativeMethods.WindowsTwaindsmDsmEntryUserinterface returns FAILURE. Help..