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

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 TwainParams.LastError always 1

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
rswyman@docuxplorer.com Posted - Sep 27 2018 : 12:49:40
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
7   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Oct 02 2018 : 01:57:49
Hi Ron

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

Nigel
Xequte Software
www.imageen.com
rswyman@docuxplorer.com Posted - Oct 01 2018 : 07:54:54
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
xequte Posted - Sep 30 2018 : 21:07:50
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
rswyman@docuxplorer.com Posted - Sep 30 2018 : 07:41:55
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
rswyman@docuxplorer.com Posted - Sep 30 2018 : 07:26:29
I guess this is change from ImageEn_SRC_6.0.0_42673 as our code has not changed. Please confirm.
xequte Posted - Sep 29 2018 : 22:41:50
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
rswyman@docuxplorer.com Posted - Sep 28 2018 : 20:22:33
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;