My application needs to "listen" for scans. Each time the user inserts a check into the scanner (Fujitsu 6130 ADF) it should automatically start the scan and save the check to a file with a unique name.
Currently I use a timer with the native transfer mode:
procedure TfmCheckScan.tmFeederLoadedTimer(Sender: TObject);
begin
tmFeederLoaded.Enabled := False;
Application.ProcessMessages;
if VSTwain1.FeederLoaded = 1 then
VSTwain1.Acquire;
else
tmFeederLoaded.Enabled := True;
end;
I save the file and reset the timer in PostScan. Two problems -- 1) every 5 scans or so it takes over a minute for the scanner to scan, then the next scan it works fine; 2) there is a memory leak.I would like to try AcquireModal, as it seems to be more appropriate, but I am confused as to whether it will "wait" for a document to be inserted in the scanner or if it will return an error if there is no document.
Could you provide me with a code snippet showing the preferred method for my needs? I do not need to display anything on screen and I do not want a UI. I tried setting the transfer format to File, but it will only create the first image and even though the scanner scans subsequent images, it never returned TRUE for FeederLoaded.
