1 Reply Latest reply on Apr 28, 2014 8:52 AM by Tim Mills

    Delphi.OnBarcodeEvent problem.

    Igor Celigor

      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;

        • Re: Delphi.OnBarcodeEvent problem.
          Tim Mills

          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.