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
 IEVisionImage AccessViolation
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

skafy

1 Posts

Posted - Oct 28 2022 :  03:55:57  Show Profile  Reply
Hi,

Im evaluating ImageEn And ImageEn version 10.3.5
I'm having an issue with barcode reader

I get AccessViolation everytime I call GetIEVisionImage(). What am I doing wrong?


unit Unit2;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, hyiedefs, hyieutils, iexBitmaps,
  iesettings, iemio, Vcl.StdCtrls, ieview, iemview, ievision;

type
  TForm2 = class(TForm)
    ImageEnMView1: TImageEnMView;
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
    procedure ImageEnMView1Changed(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form2: TForm2;

implementation

{$R *.dfm}

procedure TForm2.Button1Click(Sender: TObject);
begin
  ImageEnMView1.FillFromDirectory('C:\Users\lala\Downloads\scan\', -1, False, '', False, '', True);
end;

procedure TForm2.ImageEnMView1Changed(Sender: TObject);
begin
  var m_symbols:= IEVisionLib.createBarCodeScanner().scan(ImageEnMView1.IEBitmap.GetIEVisionImage(), IEVisionRect(0, 0, 0, 0));
end;

end.

xequte

38610 Posts

Posted - Oct 30 2022 :  19:21:59  Show Profile  Reply
Hi

I cannot reproduce that, but if you are using the OnChanged event, there will be situations where ImageEnMView1.IEBitmap is nil.

Try changing your code to:

  if ImageEnMView1.IEBitmap = nil then
    raise Exception.create( 'Image not selected' );
  var m_symbols:= IEVisionLib.createBarCodeScanner().scan(ImageEnMView1.IEBitmap.GetIEVisionImage(), IEVisionRect(0, 0, 0, 0));


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