Пример #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);
                if (Environment.OSVersion.Version.Major < 10 || rc != TwRC.Failure)
                {
                    rc = DSMident(appid, IntPtr.Zero, TwDG.Control, TwDAT.Identity, TwMSG.CloseDS, srcds);
                }
            }
        }
Пример #2
0
        public void Acquire()
        {
            TwRC rc;

            CloseSrc();
            if (appid.Id == IntPtr.Zero)
            {
                Init(hwnd);
                if (appid.Id == IntPtr.Zero)
                {
                    return;
                }
            }

            rc = DSMident(appid, IntPtr.Zero, TwDG.Control, TwDAT.Identity, TwMSG.OpenDS, srcds);
            if (rc != TwRC.Success)
            {
                return;
            }

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

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

            TwUserInterface guif = new TwUserInterface();

            guif.ShowUI     = 1;
            guif.ModalUI    = 1;
            guif.ParentHand = hwnd;
            rc = DSuserif(appid, srcds, TwDG.Control, TwDAT.UserInterface, TwMSG.EnableDS, guif);
            if (rc != TwRC.Success)
            {
                CloseSrc();
                return;
            }
        }
Пример #3
0
 internal static extern TwRC DSuserif([In, Out] TwIdentity origin, [In, Out] TwIdentity dest, TwDG dg, TwDAT dat, TwMSG msg, TwUserInterface guif);
Пример #4
0
 private TwRC DSuserif(TwIdentity origin, TwIdentity dest, TwDG dg, TwDAT dat, TwMSG msg, TwUserInterface guif)
 {
     if (IntPtr.Size == 8)
     {
         return(Twain64.DSuserif(origin, dest, dg, dat, msg, guif));
     }
     else
     {
         return(Twain32.DSuserif(origin, dest, dg, dat, msg, guif));
     }
 }