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;