This project has moved. For the latest updates, please go here.

Unable to disable Duplex !

Jun 18, 2014 at 10:31 AM
Hello,

I'm trying to enable or disable the Duplex on my device.
If i set "false" to DuplexEnable, the device scan with duplex mode too.

Any idea ?
     private static Twain32 Twain
        {
            get
            {
                if (Scanners._twain == null)
                {
                    Scanners._twain = new Twain32();
                    Scanners._twain.OpenDSM();
                    if (Scanners._twain.SourcesCount > 0)
                    {
                        Scanners._twain.SourceIndex = 0; // On sélectionne le premier scanner
                        Scanners._twain.OpenDataSource();
                        Scanners._twain.ShowUI = false;
                        if ((Scanners._twain.IsCapSupported(TwCap.Duplex) & TwQC.Get) != 0)
                        {
                            var _duplexCapValue = (ushort)Scanners._twain.GetCap(TwCap.Duplex);
                            if (_duplexCapValue > 0)
                            {
                                // 0 - TWDX_NONE
                                // 1 - TWDX_1PASSDUPLEX
                                // 2 - TWDX_2PASSDUPLEX

                                if ((Scanners._twain.IsCapSupported(TwCap.FeederEnabled) & TwQC.Set) != 0)
                                {
                                    Scanners._twain.SetCap(TwCap.FeederEnabled, true);

                                    if ((Scanners._twain.IsCapSupported(TwCap.DuplexEnabled) & TwQC.Set) != 0)
                                    {
                                        if ( MessageBox.Show("Use duplex ?","Question",MessageBoxButtons.YesNo,MessageBoxIcon.Question)==DialogResult.Yes)
                                        {
                                            Scanners._twain.SetCap(TwCap.DuplexEnabled, true);
                                        }
                                        else
                                        { 
                                            Scanners._twain.SetCap(TwCap.DuplexEnabled, false);
                                        }
                                    }
                                
                                }
                            }
                        }
                    }
                    else
                    {
                        throw new InvalidOperationException("Aucun scanner TWAIN trouvé.");
                    }
                }
                return Scanners._twain;
            }
        }
Thanks a lot :)

Regards,

Nix
Coordinator
Jun 18, 2014 at 8:12 PM
Hello, Nixeus!
Try follow code for more information.
if((Scanners._twain.IsCapSupported(TwCap.DuplexEnabled) & TwQC.Set) != 0){
    Scanners._twain.SetCap(TwCap.DuplexEnabled, MessageBox.Show("Use duplex ?","Question",MessageBoxButtons.YesNo,MessageBoxIcon.Question)==DialogResult.Yes);
    MessageBox.Show(string.Format("CAP_DUPLEXENABLED = {0}",Scanners._twain.GetCurrentCap(TwCap.DuplexEnabled)),"Info",MessageBoxButtons.OK,MessageBoxIcon.Information);
}
Jun 19, 2014 at 2:14 PM
Hello,

Thanks for the answer, nevertheless i't's not ok.
I load two pages on my device, and i have 4 images count instead two.
Coordinator
Jun 21, 2014 at 8:27 AM
Edited Jun 24, 2014 at 8:12 PM
Hello, Nixeus!
Can I see a screenshot of the "Info Message Box" after disable of the duplex?