private ArrayList TransferPictures() { ArrayList pics = new ArrayList(); if (CurrentScanner == -1) { return(pics); } TwRC rc; TwPendingXfers pendingxfer = new TwPendingXfers(); do { pendingxfer.Count = 0; IntPtr hbitmap = IntPtr.Zero; TwImageInfo imageinfo = new TwImageInfo(); rc = tw.DsImageInfo(appId, sources[CurrentScanner], TwDG.Image, TwDAT.ImageInfo, TwMSG.Get, imageinfo); if (rc != TwRC.Success) { CloseDS(); return(pics); } rc = tw.DsImagexfer(appId, sources[CurrentScanner], TwDG.Image, TwDAT.ImageNativeXfer, TwMSG.Get, ref hbitmap); if (rc != TwRC.XferDone) { CloseDS(); return(pics); } rc = tw.DsPendingxfers(appId, sources[CurrentScanner], TwDG.Control, TwDAT.PendingXfers, TwMSG.EndXfer, pendingxfer); if (rc != TwRC.Success) { CloseDS(); return(pics); } pics.Add(hbitmap); }while (pendingxfer.Count != 0); rc = tw.DsPendingxfers(appId, sources[CurrentScanner], TwDG.Control, TwDAT.PendingXfers, TwMSG.Reset, pendingxfer); return(pics); }
public TwImageInfo GetImageInfo(TwIdentity dataSourceId) { TwImageInfo result = new TwImageInfo(); TwRC rc = LibTwain32.DSiinf(fApplicationId, dataSourceId, TwDG.Image, TwDAT.ImageInfo, TwMSG.Get, result); return (rc == TwRC.Success) ? result : null; }
public bool GetImageInfo(TwIdentity dataSourceId, TwImageInfo result) { TwRC rc = LibTwain32.DSiinf(fApplicationId, dataSourceId, TwDG.Image, TwDAT.ImageInfo, TwMSG.Get, result); return (bool)(rc == TwRC.Success); }
public TwRC DsImageInfo(TwIdentity origin, TwIdentity dest, TwDG dg, TwDAT dat, TwMSG msg, TwImageInfo imageinfo) { return(DsEntryImageInfo(origin, dest, dg, dat, msg, imageinfo)); }
internal static extern TwRC DsEntryImageInfo([In, Out] TwIdentity origin, [In] TwIdentity dest, TwDG dg, TwDAT dat, TwMSG msg, [In, Out] TwImageInfo imgeinfo);
private bool TransferPictures() { bool success = IsActive(); if(success) { TwPendingXfers pxfr = new TwPendingXfers(); success = fTwain.GetNumberOfPendingTransfers(fIdent, pxfr); while(success && (pxfr.Count != 0)) { TwImageInfo iinf = new TwImageInfo(); success = fTwain.GetImageInfo(fIdent, iinf); IntPtr hBitmap = IntPtr.Zero; if(success) { success = fTwain.TransferImage(fIdent, ref hBitmap); } if(success) { Image image = null; IntPtr ptrBitmap = LibKernel32.GlobalLock(hBitmap); image = TwainUtils.DibToImage(ptrBitmap); LibKernel32.GlobalUnlock(hBitmap); Raise_OnNewPictureData(image, fSettings); } if(success) { success = fTwain.TransferEnd(fIdent, pxfr); } } } return success; }