Einzelnen Beitrag anzeigen

Benmik

Registriert seit: 11. Apr 2009
542 Beiträge
 
Delphi 11 Alexandria
 
#4

AW: GDI+ Delphi Berlin oder höher

  Alt 12. Aug 2020, 17:14
Delphi-Quellcode:
uses ... , System.SysUtils, System.IOUtils,System.Types,System.StrUtils, GDIPAPI, GDIPOBJ,GDIPUTIL;

...

procedure DatumMitGDIPlus;
Var i:integer;
  DatListe:TStringDynArray;
  GPImage: TGPImage;
  PPropItem: PPropertyItem;
  BufferSize: Cardinal;
  TxtDatum:string;
  Datum:TDateTime;
begin
  DatListe := TDirectory.GetFiles(Verz,'*.jpg');
  For i := 0 to High(Datliste) do begin
    GPImage := TGPImage.Create(DatListe[i]);
    BufferSize := GPImage.GetPropertyItemSize(PropertyTagDateTime);
    If BufferSize > 0 then begin
      GetMem(PPropItem, BufferSize);
      Try
        GPImage.GetPropertyItem(PropertyTagDateTime, BufferSize, PPropItem);
        SetString(TxtDatum, PAnsiChar(PPropItem.value), PPropItem.length - 1);
        Datum := EncodeDate(StrToInt(Copy(TxtDatum, 1, 4)),StrToInt(Copy(TxtDatum, 6, 2)),StrToInt(Copy(TxtDatum, 9, 2))) +
                 EncodeTime(StrToInt(Copy(TxtDatum, 12, 2)),StrToInt(Copy(TxtDatum, 15, 2)),StrToInt(Copy(TxtDatum, 18, 2)), 0);
      Finally
        FreeMem(PPropItem);
      end;
    end;
  end;
end;

Geändert von Benmik (12. Aug 2020 um 17:36 Uhr) Grund: uses ...
  Mit Zitat antworten Zitat