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
 TwainParams.LastError always 1
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

rswyman@docuxplorer.com

USA
156 Posts

Posted - Sep 27 2018 :  12:49:40  Show Profile  Reply
IEVision_4.5.1.0_31995 / ImageEn_SRC_8.1.0_41851

Via the AllAquire demo application I added a line in the ImageEnIO1Progress method to test the Last error value and see it always returns 1=failure.

I attach the scanner log for review.

Please advise.


// Display progress during acquisition
procedure TfrmMain.ImageEnIO1Progress(Sender: TObject; per: Integer);
const
  Show_Images_As_Acquired = True;
var
  LastError: Integer;
begin
  LastError := ImageEnMView1.MIO.TwainParams.LastError;
  showMessage(inttostr(LastError));

  ProgressBar1.Position := per;



Thanks
Ron

attach/rswyman%40docuxplorer.com/2018927132436_DXScanlog.txt

rswyman@docuxplorer.com

USA
156 Posts

Posted - Sep 28 2018 :  20:22:33  Show Profile  Reply
Hi All,

I traced the problem to imscan.pas where TWParams.LastError is never reset to zero before rc := DSM_Entry(@AppId, @SourceId, dg, dat, msg, pd); is called.

Please provide a supported fix.

Thanks
Ron

function IETW_DS(var grec: tgrec; dg: TW_UINT32; dat: TW_UINT16; msg: TW_UINT16; pd: TW_MEMREF): boolean;
var
  fpExpDisabler: TIEFPExceptionsDisabler;
begin
  with grec do
  begin
    rc := TWRC_FAILURE;
    if (@DSM_Entry <> nil) then
    begin
      try
        fpExpDisabler := TIEFPExceptionsDisabler.Create();
        try
          rc := DSM_Entry(@AppId, @SourceId, dg, dat, msg, pd);
        finally
          fpExpDisabler.Free();
        end;
        if (rc <> TWRC_SUCCESS) and (rc <> TWRC_XFERDONE) and (dat <> DAT_EVENT) and assigned(TWParams) then
        begin
          TWParams.LastError    := rc;
          TWParams.LastErrorStr := ResultToStr(rc);
          LogWrite(Format('IETW_DS : %s', [TWParams.LastErrorStr]));
        end;
      except
        on E:Exception do
        begin
          LogWrite(Format('IETW_DS : Exception -> %s', [E.Message]));
          driverException := true;
        end;
      end;
    end;
    result := (rc = TWRC_SUCCESS);
  end;
end;
Go to Top of Page

xequte

38180 Posts

Posted - Sep 29 2018 :  22:41:50  Show Profile  Reply
Hi Ron


LastError is reset correctly before scanning in TIEAcquireParams.Acquire. It does not reset before each scan because it is returning the state of the "last" error, not reset at the last success.

You should check the return value of Acquire() to determine whether scanning succeeded or not (and thus whether to consult the last error value).

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

rswyman@docuxplorer.com

USA
156 Posts

Posted - Sep 30 2018 :  07:26:29  Show Profile  Reply
I guess this is change from ImageEn_SRC_6.0.0_42673 as our code has not changed. Please confirm.
Go to Top of Page

rswyman@docuxplorer.com

USA
156 Posts

Posted - Sep 30 2018 :  07:41:55  Show Profile  Reply
Hi Nigel,
Also we need to know if the scan was performed properly at the time of the event ImageEnMView.MIO.OnAcquireBitmap. What other method is now available for knowing the scan success or failure.

Thanks
Ron
Go to Top of Page

xequte

38180 Posts

Posted - Sep 30 2018 :  21:07:50  Show Profile  Reply
Hi Ron

Comparing against v6.0.0, I cannot see any change that should affect this.

OnAcquireBitmap should not occur in the event of error. Have you seen otherwise?

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

rswyman@docuxplorer.com

USA
156 Posts

Posted - Oct 01 2018 :  07:54:54  Show Profile  Reply
Hi Nigel,

We programmed this many years ago and had error raised during this method and add this code. It seems that a change has been made in the current release so we will perform testing and see.

Thanks
Ron
Go to Top of Page

xequte

38180 Posts

Posted - Oct 02 2018 :  01:57:49  Show Profile  Reply
Hi Ron

Doing a diff, I cannot see any change that should have affected this.

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