public void CloseSrc()
        {
            TwRC rc;

            if (srcds.Id != IntPtr.Zero)
            {
                TW_USERINTERFACE guif = new TW_USERINTERFACE();
                rc = DSuserif(appid, srcds, TwDG.Control, TwDAT.UserInterface, TwMSG.DisableDS, guif);
                rc = DSMident(appid, IntPtr.Zero, TwDG.Control, TwDAT.Identity, TwMSG.CloseDS, srcds);
            }
        }
        public void Acquire()
        {
            CloseSrc();

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

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

            TwRC 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;
            }

            TW_USERINTERFACE guif = new TW_USERINTERFACE();

            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;
            }
        }
 private static extern TwRC DSuserif([In, Out] TW_IDENTITY origin, [In, Out] TW_IDENTITY dest, TwDG dg, TwDAT dat, TwMSG msg, TW_USERINTERFACE guif);
        public void CloseSrc()
        {
            TwRC rc;

            if (srcds.Id != IntPtr.Zero)
            {
                TW_USERINTERFACE guif = new TW_USERINTERFACE();
                rc = DSuserif(appid, srcds, TwDG.Control, TwDAT.UserInterface, TwMSG.DisableDS, guif);
                rc = DSMident(appid, IntPtr.Zero, TwDG.Control, TwDAT.Identity, TwMSG.CloseDS, srcds);
            }
        }
        public void Acquire()
        {
            CloseSrc();

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

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

            TwRC 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;
            }

            TW_USERINTERFACE guif = new TW_USERINTERFACE();
            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;
            }
        }
 private static extern TwRC DSuserif([In, Out] TW_IDENTITY origin, [In, Out] TW_IDENTITY dest, TwDG dg, TwDAT dat, TwMSG msg, TW_USERINTERFACE guif);