Delphi XE5, ImageEn 5.0.6, Windows 7, TWAIN drivers
My program works with a variety of scanners but lately I've had trouble with one customer using an HP ScanJet 5000. The program acquires the image displaying the scanner dialog; however, when I click Ok to continue, my application crashes. Here's some of the code used to acquire the image.
procedure TfmScanit.RefreshImages; begin if (ImageEnMView1.ImageCount>0) then begin ImageEnView1.ZoomFilter:=rfFastLinear; ImageEnMView1.CopyToIEBitmap(ImageEnMView1.SelectedImage, ImageEnView1.IEBitmap ); ImageEnView1.Zoom:=((ImageEnView1.width/ImageEnView1.IEBitmap.Width*100)-3); ImageEnView1.Update; end else begin ImageEnView1.Clear; lblSize.Caption:='Size=0kb'; end; end;
procedure TfmScanit.pnlScanitClick(Sender: TObject); begin pnlScanit.Color:=clRed; if (tblScans.recordcount=0) or (not dmSC.IsGraphic(tblScansFileExt.AsString)) then begin tblScans.Insert; tblScansScanDate.value:=now(); tblScansScanDesc.value:= 'Scanned image'; tblScansFileExt.value:='TIFF'; tblScansSize.value:=FloatToStrF(TBlobField(tblScans.FieldByName('image')).BlobSize/1000,ffNumber,5,0)+'KB'; tblScans.Post end; if (ImageEnMView1.MIO.TWainParams.SelectedSource < 0) then ImageEnMView1.MIO.SelectAcquireSource(); ImageEnMView1.MIO.AcquireClose; ImageEnMView1.MIO.TWainParams.FreeResources; ImageEnMView1.SelectSeek(iskLast); ImageEnMView1.Deselect; // to append images Need2Save:=ImageEnMView1.MIO.Acquire; ImageEnMView1.SelectSeek(iskLast); RefreshImages; pnlScanit.Color:=clNavy; end;
It gets to the Need2Save line and bombs.
Anything you can see that I'm not doing or doing that I don't need to do? I know this is difficult to troubleshoot. Just looking for some direction. When I use TWAIN drivers, it crashes. When I use WIA drivers, it works but the scanner dialog is not robust enough.
Thanks for any help.
Bill
|