Home › Forums › TWAIN Classic › Please tell me how Duplex scanning with C# program? › Re: Do you solve the duplex acquisition problem?
Hi,
I tryed to set the duplex capability, but the return message is always failure (I tried with 2 different scanner),
anyway the setting has no effect on the acquisition.
I checked the duplex capability, and the aswer is success.
This is my code:
TwRC rc;
rc = DSMident(appid, IntPtr.Zero, TwDG.Control, TwDAT.Identity, TwMSG.OpenDS, srcds);
if (rc != TwRC.Success) return;
//I set the multi-page capability
TwCapability cap = new TwCapability(TwCap.XferCount, -1);
rc = DScap(appid, srcds, TwDG.Control, TwDAT.Capability, TwMSG.Set, cap);
if (rc != TwRC.Success) {
CloseSrc();
return; }
//I'm trying to disable the duplex
TwCapability capDuplex = new TwCapability(TwCap.CAP_DUPLEXENABLED,0);
//In this point I receive Failure
rc = DScap(appid, srcds, TwDG.Control, TwDAT.Capability, TwMSG.Set, capDuplex
Is this code correct?
Do you have any suggestion?
Thank you
@gabe wrote:
Right. You may want to check the return and condition codes further on your calls. You also may want to consider checking querysupport before setting the cap.
But more directly, it looks like you abort the scan if Any of the caps you are setting return anything but success. When you step thru this with your device, where does it exit?
Could be that for your device it returns when setting xfercount (not likely but possible), duplexEnabled (more likely – specially since you don’t seem to be checking whether or how duplex is supported first, I suspect this call the most), or even feederEnabled.I’m assuming that you are certain that the device supports duplex?
So step thru it, where does it return when intDuplex==1?, and what was the specific rc and cc?
And what are you using for a source?I’m going to guess this is based on netmasters code from codeproject, did you adjust the constructor for a new cap or are you using his code as-is?
gabe