Example #1
0
        public void CloseSrc()
        {
            TwRC rc;

            if (srcds.Id != IntPtr.Zero)
            {
                TwUserInterface guif = new TwUserInterface();
                rc = DSuserif(appid, srcds, TwDG.Control, TwDAT.UserInterface, TwMSG.DisableDS, guif);
                rc = DSMident(appid, IntPtr.Zero, TwDG.Control, TwDAT.Identity, TwMSG.CloseDS, srcds);
            }
        }
Example #2
0
        public void Acquire(bool showUI)
        {
            TwRC rc;

            CloseSrc();


            if (appid.Id == IntPtr.Zero)
            {
                Init(hwnd);
                if (appid.Id == IntPtr.Zero)
                {
                    BuildScannerException(srcds, TwainScannerError.ScannerNotAvailable);
                }
            }


            rc = DSMident(appid, IntPtr.Zero, TwDG.Control, TwDAT.Identity, TwMSG.OpenDS, srcds);



            //
            if (rc != TwRC.Success)
            {
                BuildScannerException(srcds, TwainScannerError.ScannerNotAvailable);
            }

            TwCapability cap = new TwCapability(TwCap.XferCount, 1);

            rc = DScap(appid, srcds, TwDG.Control, TwDAT.Capability, TwMSG.Set, cap);
            if (rc != TwRC.Success)
            {
                CloseSrc();
                BuildScannerException(srcds, TwainScannerError.Other);
            }

            TwUserInterface guif = new TwUserInterface();

            guif.ShowUI     = Convert.ToInt16(showUI);
            guif.ModalUI    = 1;
            guif.ParentHand = hwnd;
            rc = DSuserif(appid, srcds, TwDG.Control, TwDAT.UserInterface, TwMSG.EnableDS, guif);
            if (rc != TwRC.Success)
            {
                CloseSrc();
                BuildScannerException(srcds, TwainScannerError.Other);
            }
        }
Example #3
0
 private static extern TwRC DSuserif([In, Out] TwIdentity origin, [In, Out] TwIdentity dest, TwDG dg, TwDAT dat, TwMSG msg, TwUserInterface guif);