Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Programmieren allgemein (https://www.delphipraxis.net/40-programmieren-allgemein/)
-   -   Delphi QS-Barcode SDK Falsche Parameter (https://www.delphipraxis.net/193694-qs-barcode-sdk-falsche-parameter.html)

JeHo 30. Aug 2017 10:16

QS-Barcode SDK Falsche Parameter
 
Moin,

momentan versuche ich mich an der Barcode Erkennung. Dafür benutze ich die https://www.qualitysoft.de/de/produk...rcode-sdk.html F-Schnittstelle (Datei-Schnittstelle). Im Tester werden die erstellten Aztec-Codes erkannt, aber in meiner Anwendung werden diese nicht erkannt. Ich habe die Einstellungen aus dem Tester übernommen.

Das ist der Code:
Code:
procedure TForm1.Button2Click(Sender: TObject);
var isExecuted : Boolean;
    FileName   : String;
 
    iResults   : Integer;
    Barcode    : BarCode2;
    pBarcode   : PBarCode2;
    BarcodeResult : BarcodeResult2;
    pBarcodeResult : PBarcodeResult2;
    AM : AdvancedMode;
    pAM : PAdvancedMode;
    nRet : Integer;
    //szVersion: array [0..10] of Char;
    szVersion : arVersion;

begin

  //  Folgende Einstellungen hat der bcTester fuer den Aztec Code:
  //  Type : Aztec Code                               (iBC_Type  = BC_AZTEC)
  //  Laenge : 1                                        (1BC_Length = 1)
  //  Prüfsumme : None                                 (iBC_Checksum = BC_CHECKNONE)
  //  Barcodeverdacht melden (Existenzpruefung) : TRUE (iBC_Checksum = BC_EXISTENCE)
  //  Anzahl : MULTI                                   (iBC_ReadMultiple = BC_MULTI)
  //  Rotation : 0,90,180,270                           (iBC_Orientation = BC_0, BC_90, BC_180, BC_270
  //  Maximale Verdrehung : 8                           (iBC_Orientation = BC_SKREW_LIGHT

  // Open the File
  isExecuted := FileOpenDialog1.Execute;

  if isExecuted then
  begin

    FileName := FileOpenDialog1.FileName;
    try
      // Fill Barcode-Structure with suitable values. BEGIN
      Barcode.iBC_Type           := BC_AZTEC;
      Barcode.iBC_Length         := 0;
      Barcode.iBC_Checksum       := BC_CHECKNONE;                                
      Barcode.iBC_Checksum       := BC_EXISTENCE;                                // Existenzpruefung
      Barcode.iBC_ReadMultiple   := BC_MULTI;
      Barcode.iBC_Orientation    := BC_0 or BC_90 or BC_180 or BC_270;
      Barcode.iBC_Orientation    := BC_SKEW_LIGHT;
      Barcode.iBC_ScanDistBarcode := BC_SCANDISTBAR;                           // Scanabstand
      Barcode.iBC_ScanDistance   := BC_SCANDISTANCE;                          // Suchabstand
      // Fill Barcode-Structure with suitable values. END

      // Advanced Search Settings BEGIN
      AM.AdvancedSearch      := 1;
      AM.DynamicThreshold    := 1;
      AM.iBC_Threshold       := 0;
      AM.iBC_RemovePixel     := 0;
      AM.iBC_LightMargin1     := 30;
      AM.iBC_LightMargin2     := 0;
      AM.iBC_LightMargin3     := 0;
      AM.iBC_ScanDIstance2    := 0;
      AM.iBC_ScanDistBarcode2 := 0;
      // Advanced Search Settings End

      pAM := addr(AM);

      pBarcode := addr(Barcode);
      QSVersion(szVersion);

      // now start to search
      nRet := QSReadBarcode5(PAnsiChar(FileName), pBarcode, iResults, '','', pAM);
      if nRet = BC_OK then
      begin
        // give out the results
        while QSGetNextBarResult2(pBarcodeResult) <> BC_NO_BARCODE do
          MessageDlg('Barcode Found:' + BarcodeResult.szBC_Barcode, mtWarning, [mbOK], 0);
        QSFreeBarResult2;
      end
    finally
      // Free Objects
    end;

  end;
end;
Der Fehlercode ist Barcode wrong parameters. Vielleicht habt ihr ja eine Idee, was ich falsch mache :)

Grüße

JeHo

Marcludi 30. Aug 2017 10:30

AW: QS-Barcode SDK Falsche Parameter
 
Ohne jetzt irgendwelche Ahnung davon zu haben, fällt mir auf:

- Oben in den Kommentaren steht
Code:
//  Laenge : 1 (1BC_Length = 1)
Unten im Code jedoch
Code:
1BC_Length = 0
- Oben:
Code:
//  Maximale Verdrehung : 8                           (iBC_Orientation = BC_SKREW_LIGHT
Unten:
Code:
Barcode.iBC_Orientation := BC_SKEW_LIGHT;
Vielleicht ists ja nur ein Tippfehler und das hilft dir trotzdem weiter. Ansonsten lass ich mal die Experten vor ;)

HolgerX 30. Aug 2017 12:22

AW: QS-Barcode SDK Falsche Parameter
 
Hmm..

Delphi-Quellcode:
      Barcode.iBC_Type          := BC_AZTEC;
      Barcode.iBC_Length        := 0;
      Barcode.iBC_Checksum      := BC_CHECKNONE;                              
      Barcode.iBC_Checksum      := BC_EXISTENCE;                               // Existenzpruefung
      Barcode.iBC_ReadMultiple  := BC_MULTI;
      Barcode.iBC_Orientation   := BC_0 or BC_90 or BC_180 or BC_270;
      Barcode.iBC_Orientation   := BC_SKEW_LIGHT;
      Barcode.iBC_ScanDistBarcode := BC_SCANDISTBAR;                          // Scanabstand
      Barcode.iBC_ScanDistance  := BC_SCANDISTANCE;                         // Suchabstand
müsste dass nicht so sein:

Delphi-Quellcode:
      Barcode.iBC_Type          := BC_AZTEC;
      Barcode.iBC_Length        := 0;
      Barcode.iBC_Checksum      := BC_CHECKNONE or BC_EXISTENCE;                              
      Barcode.iBC_ReadMultiple  := BC_MULTI;
      Barcode.iBC_Orientation   := BC_0 or BC_90 or BC_180 or BC_270 or BC_SKEW_LIGHT;
      Barcode.iBC_ScanDistBarcode := BC_SCANDISTBAR;                          // Scanabstand
      Barcode.iBC_ScanDistance  := BC_SCANDISTANCE;                         // Suchabstand
Ansonsten überschreibst Du doch z.B. bei Barcode.iBC_Checksum das BC_CHECKNONE mit BC_EXISTENCE.

Eine Typ-Variable kann nochmalerweise nur einen Wert haben ;)


Alle Zeitangaben in WEZ +1. Es ist jetzt 18:19 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz