public ArrayList TransferPictures() { var pics = new ArrayList(); if (srcds.Id == IntPtr.Zero) { return(pics); } TwReturnCode returnCode; IntPtr hbitmap = IntPtr.Zero; var pxfr = new TwPendingXfers(); do { pxfr.Count = 0; hbitmap = IntPtr.Zero; var iinf = new TwImageInfo(); returnCode = DSiinf(appid, srcds, TwDG.Image, TwData.ImageInfo, TwMessageCode.Get, iinf); if (returnCode != TwReturnCode.Success) { CloseSrc(); return(pics); } returnCode = DSixfer(appid, srcds, TwDG.Image, TwData.ImageNativeXfer, TwMessageCode.Get, ref hbitmap); if (returnCode != TwReturnCode.XferDone) { CloseSrc(); return(pics); } returnCode = DSpxfer(appid, srcds, TwDG.Control, TwData.PendingXfers, TwMessageCode.EndXfer, pxfr); if (returnCode != TwReturnCode.Success) { CloseSrc(); return(pics); } pics.Add(hbitmap); }while (pxfr.Count != 0); returnCode = DSpxfer(appid, srcds, TwDG.Control, TwData.PendingXfers, TwMessageCode.Reset, pxfr); return(pics); }
private static extern TwReturnCode DSiinf([In, Out] TwIdentity origin, [In] TwIdentity dest, TwDG dg, TwData data, TwMessageCode messageCode, [In, Out] TwImageInfo imginf);
public ArrayList TransferPictures() { var pics = new ArrayList(); if (srcds.Id == IntPtr.Zero) return pics; TwReturnCode returnCode; IntPtr hbitmap = IntPtr.Zero; var pxfr = new TwPendingXfers(); do { pxfr.Count = 0; hbitmap = IntPtr.Zero; var iinf = new TwImageInfo(); returnCode = DSiinf(appid, srcds, TwDG.Image, TwData.ImageInfo, TwMessageCode.Get, iinf); if (returnCode != TwReturnCode.Success) { CloseSrc(); return pics; } returnCode = DSixfer(appid, srcds, TwDG.Image, TwData.ImageNativeXfer, TwMessageCode.Get, ref hbitmap); if (returnCode != TwReturnCode.XferDone) { CloseSrc(); return pics; } returnCode = DSpxfer(appid, srcds, TwDG.Control, TwData.PendingXfers, TwMessageCode.EndXfer, pxfr); if (returnCode != TwReturnCode.Success) { CloseSrc(); return pics; } pics.Add(hbitmap); } while (pxfr.Count != 0); returnCode = DSpxfer(appid, srcds, TwDG.Control, TwData.PendingXfers, TwMessageCode.Reset, pxfr); return pics; }