ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Cancel acquire ...
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

Dany

45 Posts

Posted - Aug 23 2018 :  14:51:34  Show Profile  Reply
Hi;

I moved the acquisition procedure to a separated thread that own a ImageEnMView for acquiring, and in that way my main process is not freezed, and user can cancel the waiting. But it will be much better if I can say MIO to full cancel finishing in some way the driver dialog.

I tried to add FCollection.MIO.Aborting := True in the OnAcquireBitmap event, but it does nothing.

Is there any other idea?.

Thank you!

Dany

xequte

38209 Posts

Posted - Aug 23 2018 :  19:48:10  Show Profile  Reply
Hi Dany

Acquisition cannot be aborted for WIA in code, but will work for Twain and WPD.

If you are using Twain, are you able to create a simple demo that reproduces the issue.

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

Dany

45 Posts

Posted - Aug 23 2018 :  21:45:17  Show Profile  Reply
Hi Nigel;

Thank you. I only use TWAIN, but can't find how to cancel. Before trying threads, I tryed to use AcquireOpen/AcquireClose but I can't figure out how. A while after I call AcquireOpen, my OnAquireClose event is called but no sanning process was done before. Also I can't find any example about how to use AcquireOpen/AcquireClose.
Go to Top of Page

xequte

38209 Posts

Posted - Aug 23 2018 :  23:20:55  Show Profile  Reply
Hi Dany

We tend not to favor the use of TwainAcquireOpen/TwainAcquireClose, and it won't prevent UI lock, because it does not run in a thread.

You can either use a TImageEnIO with AsyncMode set to true, or you could create a background thread and instantiate a TIEAcquireParams to perform the acquisition.

If you are using XE7 or newer, then this should be fairly easy using the TTask class.



Nigel
Xequte Software
www.imageen.com
Go to Top of Page

Dany

45 Posts

Posted - Aug 24 2018 :  07:01:02  Show Profile  Reply
Hi Nigel;

I understand. As I said first, I did a threaded solution and it works. The only think that does not lock "profesional" is that when user cancel acquire from my application, scanner continues working, and scanner dialog is still active, and user have to cancel it "again". This is not so nice ....

AsyncMode is not available under TIMageEnMIO nor TIEAcquireParams for acquiring, I guess.

Dany
Go to Top of Page

Dany

45 Posts

Posted - Aug 25 2018 :  21:45:49  Show Profile  Reply
Hi Nigel;

I was reading in deep your source code and after understanding it, I did it to work, without threading, just by using AcquireParams.Aborting, it is fine.

Thank you!
Go to Top of Page

Dany

45 Posts

Posted - Aug 27 2018 :  10:08:02  Show Profile  Reply
Hi Nigel;

What I see is for example, is the queue has 6 pages and I set Aborting = True when the scanner is working in page #2, it is possible to see it not aborting, but finishing all the pages. So application is stopped waiting for acquire to finish (I only work with TWAIN). The only solution I found is to raise an exception when user need to cancel, and catching the exception after.

Thank you!
Go to Top of Page

xequte

38209 Posts

Posted - Aug 27 2018 :  17:03:55  Show Profile  Reply
Hi

Setting MIO.Aborting will also set MIO.AcquireParams.Aborting.

The call to abort is simply passed to the Twain driver, so ImageEn cannot control the way the driver handles the abort.

Nigel
Xequte Software
www.imageen.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: