public ArrayList TransferPictures() { ArrayList pics = new ArrayList(); if (srcds.Id == IntPtr.Zero) { return(pics); } TwRC rc; IntPtr hbitmap = IntPtr.Zero; TwPendingXfers pxfr = new TwPendingXfers(); do { pxfr.Count = 0; hbitmap = IntPtr.Zero; TwImageInfo iinf = new TwImageInfo(); rc = DSiinf(appid, srcds, TwDG.Image, TwDAT.ImageInfo, TwMSG.Get, iinf); if (rc != TwRC.Success) { CloseSrc(); return(pics); } rc = DSixfer(appid, srcds, TwDG.Image, TwDAT.ImageNativeXfer, TwMSG.Get, ref hbitmap); if (rc != TwRC.XferDone) { CloseSrc(); return(pics); } rc = DSpxfer(appid, srcds, TwDG.Control, TwDAT.PendingXfers, TwMSG.EndXfer, pxfr); if (rc != TwRC.Success) { CloseSrc(); return(pics); } pics.Add(hbitmap); }while (pxfr.Count != 0); rc = DSpxfer(appid, srcds, TwDG.Control, TwDAT.PendingXfers, TwMSG.Reset, pxfr); return(pics); }
internal static extern TwRC DSpxfer([In, Out] TwIdentity origin, [In] TwIdentity dest, TwDG dg, TwDAT dat, TwMSG msg, [In, Out] TwPendingXfers pxfr);
private TwRC DSpxfer(TwIdentity origin, TwIdentity dest, TwDG dg, TwDAT dat, TwMSG msg, TwPendingXfers pxfr) { if (IntPtr.Size == 8) { return(Twain64.DSpxfer(origin, dest, dg, dat, msg, pxfr)); } else { return(Twain32.DSpxfer(origin, dest, dg, dat, msg, pxfr)); } }