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
 How to stop scan in the ImageEnMView's OnAcquireBitmap?
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

Flashcqxg

96 Posts

Posted - Oct 31 2022 :  06:50:54  Show Profile  Reply
Hello,i want to stop the scan in the ImageEnMView's OnAcquireBitmap,but it can not stop.
For example, I scan 100 sheets of paper. If an error is detected when scanning to the second sheet, I want to stop scanning, but the following code cannot prevent the scanner from continuing to scan. How can I stop scanning the scanner?

procedure TFrmScan.ImageEnMViewAcquireBitmap(Sender: TObject; ABitmap: TIEBitmap; DpiX, DpiY: Integer; var Handled: Boolean);
begin

if CheckError then
ImageEnMView.MIO.Aborting := True;

end;

xequte

38684 Posts

Posted - Oct 31 2022 :  20:19:33  Show Profile  Reply
Hi

To cancel scanning:

ImageEnMView1.MIO.AcquireParams.Aborting := True;

https://www.imageen.com/help/TIEAcquireParams.Aborting.html


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

Flashcqxg

96 Posts

Posted - Nov 01 2022 :  19:05:16  Show Profile  Reply
Hi:
My code:

procedure TFrmScan.ImageEnMViewAcquireBitmap(Sender: TObject; ABitmap: TIEBitmap; DpiX, DpiY: Integer; var Handled: Boolean);
begin
  if CheckError then
  begin
    ImageEnMView.MIO.AcquireParams.Aborting := True;
    ShowMessage('there are errors !');
  end;
end;


but the scanner will scan all the paper!
Go to Top of Page

xequte

38684 Posts

Posted - Nov 01 2022 :  20:27:40  Show Profile  Reply
If Aborting is set in OnAcquireBitmap it will still add the current image to the MView. To avoid this set:

Handled := True;

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

Flashcqxg

96 Posts

Posted - Nov 02 2022 :  21:39:33  Show Profile  Reply
Hello:
my code:

procedure TFrmScan.ImageEnMViewAcquireBitmap(Sender: TObject; ABitmap: TIEBitmap; DpiX, DpiY: Integer; var Handled: Boolean);
begin
  if CheckError then
  begin
    ImageEnMView.MIO.AcquireParams.Aborting := True;
    Handled := True;
    ShowMessage('there are errors !');
  end;
end;

When running this code, a dialogue window will pop up, and the scanner will not stop scanning until all the papers have been scanned. Why? I want to stop scanning when encountering errors and pop up a prompt dialog window.
Go to Top of Page

xequte

38684 Posts

Posted - Nov 03 2022 :  23:16:24  Show Profile  Reply
Hi

Is this using a Twain or WIA driver?

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

Flashcqxg

96 Posts

Posted - Nov 06 2022 :  17:31:26  Show Profile  Reply
Hello:
I used the Twain driver.
Go to Top of Page

xequte

38684 Posts

Posted - Nov 06 2022 :  18:14:11  Show Profile  Reply
Hmm, I cannot reproduce that here. We'll need to investigate.

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

Flashcqxg

96 Posts

Posted - Nov 06 2022 :  18:15:58  Show Profile  Reply
Thank you. Do you want me to make a demo?
Go to Top of Page

xequte

38684 Posts

Posted - Nov 06 2022 :  18:18:41  Show Profile  Reply
Yes, if you want to create a very simple demo that shows the problem, we can test that here.

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

Flashcqxg

96 Posts

Posted - Nov 06 2022 :  18:20:15  Show Profile  Reply
OK, I'll make a simple demo and upload it here.
Go to Top of Page

Flashcqxg

96 Posts

Posted - Nov 06 2022 :  18:50:03  Show Profile  Reply
I uploaded the demo and made comments in the relevant code.

attach/Flashcqxg/2022116184930_TwainStore - can not auto stop.zip
57.57 KB

Go to Top of Page

xequte

38684 Posts

Posted - Nov 07 2022 :  17:43:00  Show Profile  Reply
Hi

Please email me for an update that fully supports this.

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

Flashcqxg

96 Posts

Posted - Nov 07 2022 :  18:10:49  Show Profile  Reply
I email to support@xequte.com.
Thanks.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: