Exemplo n.º 1
0
        public ArrayList TransferPictures()
        {
            ArrayList pics = new ArrayList();

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

            twainDefs.TwRC rc      = 0;
            IntPtr         hbitmap = IntPtr.Zero;

            twainDefs.TwPendingXfers pxfr = new twainDefs.TwPendingXfers();

            do
            {
                pxfr.Count = 0;
                hbitmap    = IntPtr.Zero;

                twainDefs.TwImageInfo iinf = new twainDefs.TwImageInfo();
                rc = DSiinf(appid, srcds, twainDefs.TwDG.Image, twainDefs.TwDAT.ImageInfo, twainDefs.TwMSG.Get, iinf);
                if (rc != twainDefs.TwRC.Success)
                {
                    CloseSrc();
                    return(pics);
                }

                rc = DSixfer(appid, srcds, twainDefs.TwDG.Image, twainDefs.TwDAT.ImageNativeXfer, twainDefs.TwMSG.Get, ref hbitmap);
                if (rc != twainDefs.TwRC.XferDone)
                {
                    CloseSrc();
                    return(pics);
                }

                rc = DSpxfer(appid, srcds, twainDefs.TwDG.Control, twainDefs.TwDAT.PendingXfers, twainDefs.TwMSG.EndXfer, pxfr);
                if (rc != twainDefs.TwRC.Success)
                {
                    CloseSrc();
                    return(pics);
                }

                pics.Add(hbitmap);
            }while (pxfr.Count != 0);

            rc = DSpxfer(appid, srcds, twainDefs.TwDG.Control, twainDefs.TwDAT.PendingXfers, twainDefs.TwMSG.Reset, pxfr);
            return(pics);
        }
Exemplo n.º 2
0
 private static extern twainDefs.TwRC DSiinf([In, Out] twainDefs.TwIdentity origin, [In] twainDefs.TwIdentity dest, twainDefs.TwDG dg, twainDefs.TwDAT dat, twainDefs.TwMSG msg, [In, Out] twainDefs.TwImageInfo imginf);