Delphi.OnBarcodeEvent problem.

Motorola ds4208.IBM hand-held USB.

barcode :PDF417

Delphi.On OnBarcodeEvent I have error "Invalid variant type conversion" and no message("Success!") at all.

Whats wrong?Help!

 

procedure TForm1.OnBarcodeEvent(Sender: TObject; eventType: Smallint; var pscanData: OleVariant);

begin

    showmessage('Success!');

end;

 

procedure TForm1.Button1Click(Sender: TObject);

begin

CCoreScanner1:=TCCoreScanner.Create(nil);

....

CCoreScanner1.OnBarcodeEvent := OnBarcodeEvent;

opcode:=1001;

inXML:= '<inArgs>' +

                       '<cmdArgs>' +

                           '<arg-int>1</arg-int>' +

                           '<arg-int>1</arg-int>' +

                       '</cmdArgs>' +

                    '</inArgs>';

CCoreScanner1.ExecCommand(opcode, inXML, outXML, status);

end;

Tim Mills
I had a quick look at your

I had a quick look at your code. The one difference I see is that your pscanData parameter in procedure TForm1.OnBarcodeEvent is declared as an OLEVariant. My code declares this as a WideString. This difference would cause the "Invalid variant type conversion" you are getting.

Let me know if this fixes the problem.


Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Log in to post comments