⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 unit1.pas

📁 Borland没有提供对Gdiplus的支持
💻 PAS
字号:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
  Dialogs, GDIPAPI, GDIPOBJ, GDIPUTIL, StdCtrls;

type
  TForm1 = class(TForm)
    Memo1: TMemo;
    Button2: TButton;
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button2Click(Sender: TObject);
type
  ArrItems = array of TPROPERTYITEM;
  ac = array of char;
var
  bitmap: TGPBitmap;
  size, count: UINT;
  strPropertyType: String;
  pPropBuffer: PPROPERTYITEM;
  j: Integer;
begin
  bitmap:= TGPBitmap.Create('..\untitled.JPG');
  bitmap.GetPropertySize(size, count);
  memo1.Clear;
  memo1.Lines.Add(format('There are %d pieces of metadata in the file.',[count]));
  memo1.Lines.Add(format('The total size of the metadata is %d bytes.',[size]));
  memo1.Lines.Add('');

  // GetAllPropertyItems returns an array of PropertyItem objects.
  // Allocate a buffer large enough to receive that array.
  //SetLength(pPropBuffer, count);
  Getmem(pPropBuffer, Size);
  ZeroMemory(pPropBuffer, Size);

  // Get the array of PropertyItem objects.
  bitmap.GetAllPropertyItems(size, count, pPropBuffer);

  // For each PropertyItem in the array, display the id, type, and length.
  for j := 0 to count - 1 do
  begin
    // Convert the property type from a WORD to a string.
    strPropertyType := ValueTypeFromULONG(ArrItems(pPropBuffer)[j].type_);
    memo1.Lines.Add(format('Property Item %d', [j]));
    memo1.Lines.Add(format('  id: %s ($%x)', [GetMetaDataIDString(ArrItems(pPropBuffer)[j].id),ArrItems(pPropBuffer)[j].id]));
    memo1.Lines.Add(format('  type: %s (%d)', [strPropertyType, j]));
    memo1.Lines.Add(format('  length: %d bytes', [ArrItems(pPropBuffer)[j].length]));
    memo1.Lines.Add('');
  end;

  FreeMem(pPropBuffer, Size);
  bitmap.Free;
end;



end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -