Thema: Delphi Array Problem

Einzelnen Beitrag anzeigen

marabu

Registriert seit: 6. Apr 2005
10.109 Beiträge
 
#9

Re: Array Problem

  Alt 2. Dez 2005, 20:22
Hallo.

Du musst den Speicher für deine vier Image Descriptoren dynamisch anfordern:

Delphi-Quellcode:
var
  pExtImgInfo: PTW_ExtImageInfo;
  pInfo: PTW_Info;
  iCount, iSize: cardinal;
  sBarcodeText: string;
begin
  iCount := 4; // Anzahl der Infos
  iSize := SizeOf(TW_UINT32) + iCount * SizeOf(TW_INFO);
  GetMem(pExtImgInfo, iSize);

  pExtImgInfo^.NumInfos := iCount;

  pInfo := @pExtImgInfo^.Info; // auf erstes item zeigen
  with pInfo^ do
  begin
    InfoID := TWEI_BARCODETYPE;
    ItemType := TWTY_UINT32;
    NumItems := 0;
    CondCode := 0;
    Item := 0;
  end;

  Inc(pInfo); // auf nächstes Item zeigen
  with pInfo^ do
  begin
    InfoID := TWEI_BARCODETYPE;
    ItemType := TWTY_UINT32;
    NumItems := 0;
    CondCode := 0;
    Item := 0;
  end;

  // ...

  FreeMem(pExtImgInfo, iSize); // Speicher wieder freigeben
end;
Grüße vom marabu
  Mit Zitat antworten Zitat