程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 更多編程語言 >> Delphi >> 再學 GDI+[102]: TGPImage(22) - 獲取所有解碼器的詳細信息

再學 GDI+[102]: TGPImage(22) - 獲取所有解碼器的詳細信息

編輯:Delphi

 本例運行結果:Clsid: {557CF400-1A04-11D3-9A73-0000F81EF32E}
FormatID: {B96B3CAB-0728-11D3-9D7B-0000F81EF32E}
CodecName: Built-in BMP Codec
DllName:
FormatDescription: BMP
FilenameExtension: *.BMP;*.DIB;*.RLE
MimeType: image/bmp
Flags: 65543
Version: 1
SigCount: 1
SigSize: 2
Clsid: {557CF401-1A04-11D3-9A73-0000F81EF32E}
FormatID: {B96B3CAE-0728-11D3-9D7B-0000F81EF32E}
CodecName: Built-in JPEG Codec
DllName:
FormatDescription: JPEG
FilenameExtension: *.JPG;*.JPEG;*.JPE;*.JFIF
MimeType: image/jpeg
Flags: 65543
Version: 1
SigCount: 1
SigSize: 2
Clsid: {557CF402-1A04-11D3-9A73-0000F81EF32E}
FormatID: {B96B3CB0-0728-11D3-9D7B-0000F81EF32E}
CodecName: Built-in GIF Codec
DllName:
FormatDescription: GIF
FilenameExtension: *.GIF
MimeType: image/gif
Flags: 65543
Version: 1
SigCount: 2
SigSize: 6
Clsid: {557CF403-1A04-11D3-9A73-0000F81EF32E}
FormatID: {B96B3CAC-0728-11D3-9D7B-0000F81EF32E}
CodecName: Built-in EMF Codec
DllName:
FormatDescription: EMF
FilenameExtension: *.EMF
MimeType: image/x-emf
Flags: 65542
Version: 1
SigCount: 1
SigSize: 44
Clsid: {557CF404-1A04-11D3-9A73-0000F81EF32E}
FormatID: {B96B3CAD-0728-11D3-9D7B-0000F81EF32E}
CodecName: Built-in WMF Codec
DllName:
FormatDescription: WMF
FilenameExtension: *.WMF
MimeType: image/x-wmf
Flags: 65542
Version: 1
SigCount: 1
SigSize: 4
Clsid: {557CF405-1A04-11D3-9A73-0000F81EF32E}
FormatID: {B96B3CB1-0728-11D3-9D7B-0000F81EF32E}
CodecName: Built-in TIFF Codec
DllName:
FormatDescription: TIFF
FilenameExtension: *.TIF;*.TIFF
MimeType: image/tiff
Flags: 65543
Version: 1
SigCount: 2
SigSize: 2
Clsid: {557CF406-1A04-11D3-9A73-0000F81EF32E}
FormatID: {B96B3CAF-0728-11D3-9D7B-0000F81EF32E}
CodecName: Built-in PNG Codec
DllName:
FormatDescription: PNG
FilenameExtension: *.PNG
MimeType: image/png
Flags: 65543
Version: 1
SigCount: 1
SigSize: 8
Clsid: {557CF407-1A04-11D3-9A73-0000F81EF32E}
FormatID: {B96B3CB5-0728-11D3-9D7B-0000F81EF32E}
CodecName: Built-in ICO Codec
DllName:
FormatDescription: ICO
FilenameExtension: *.ICO
MimeType: image/x-icon
Flags: 65542
Version: 1
SigCount: 1
SigSize: 4
代碼文件:unit Unit1;
interface
uses
 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
 Dialogs, StdCtrls;
type
 TForm1 = class(TForm)
  Memo1: TMemo;
  Button1: TButton;
  procedure FormCreate(Sender: TObject);
  procedure Button1Click(Sender: TObject);
 end;
var
 Form1: TForm1;
implementation
{$R *.dfm}
uses GDIPOBJ, GDIPAPI;
procedure TForm1.FormCreate(Sender: TObject);
begin
 Memo1.Align := alLeft;
 Memo1.ScrollBars := ssBoth;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
 num, size: Cardinal;
 ImageCodecInfo: PImageCodecInfo;
 i: Integer;
type
 ArrImgCodInfo = array of TImageCodecInfo;
begin
 GetImageDecodersSize(num, size);
 GetMem(ImageCodecInfo, size);
 GetImageDecoders(num, size, ImageCodecInfo);
 Memo1.Clear;
 for i := 0 to num - 1 do with Memo1.Lines do
 begin
  Add(format('Clsid: %s',[GUIDToString(ArrImgCodInfo(ImageCodecInfo)[i].Clsid)]));
  Add(format('FormatID: %s',[GUIDToString(ArrImgCodInfo(ImageCodecInfo)[i].FormatID)]));
  Add(format('CodecName: %s',[ArrImgCodInfo(ImageCodecInfo)[i].CodecName]));
  Add(format('DllName: %s',[ArrImgCodInfo(ImageCodecInfo)[i].DllName]));
  Add(format('FormatDescription: %s',[ArrImgCodInfo(ImageCodecInfo)[i].FormatDescription]));
  Add(format('FilenameExtension: %s',[ArrImgCodInfo(ImageCodecInfo)[i].FilenameExtension]));
  Add(format('MimeType: %s',[ArrImgCodInfo(ImageCodecInfo)[i].MimeType]));
  Add(format('Flags: %d',[ArrImgCodInfo(ImageCodecInfo)[i].Flags]));
  Add(format('Version: %d',[ArrImgCodInfo(ImageCodecInfo)[i].Version]));
  Add(format('SigCount: %d',[ArrImgCodInfo(ImageCodecInfo)[i].SigCount]));
  Add(format('SigSize: %d',[ArrImgCodInfo(ImageCodecInfo)[i].SigSize]));
  Add('');
 end;
 FreeMem(ImageCodecInfo);
end;
end.
窗體文件:object Form1: TForm1
 Left = 0
 Top = 0
 Caption = 'Form1'
 ClIEntHeight = 206
 ClIEntWidth = 445
 Color = clBtnFace
 Font.Charset = DEFAULT_CHARSET
 Font.Color = clWindowText
 Font.Height = -11
 Font.Name = 'Tahoma'
 Font.Style = []
 OldCreateOrder = False
 OnCreate = FormCreate
 PixelsPerInch = 96
 TextHeight = 13
 object Memo1: TMemo
  Left = 8
  Top = 8
  Width = 337
  Height = 145
  Lines.Strings = (
   'Memo1')
  TabOrder = 0
 end
 object Button1: TButton
  Left = 351
  Top = 32
  Width = 75
  Height = 25
  Caption = 'Button1'
  TabOrder = 1
  OnClick = Button1Click
 end
end
Clsid       //獲取或設置 Guid 結構,其中包含能識別特定編碼解碼器的 GUID。
FormatID      //獲取或設置 Guid 結構,其中包含用於識別編碼解碼器格式的 GUID。
CodecName     //獲取或設置包含編碼解碼器名稱的字符串。
DllName      //獲取或設置包含存放編碼解碼器的 DLL 的路徑名字符串。如果編碼解碼器不在 DLL 中,則該指針為空。
FormatDescription //獲取或設置描述編碼解碼器的文件格式的字符串。
FilenameExtension //獲取或設置包含編碼解碼器中使用的文件擴展名的字符串。這些擴展名用分號分隔。
MimeType      //獲取或設置包含編碼解碼器的多用途網際郵件擴充協議 (MIME) 類型的字符串。
Flags       //獲取或設置用於存儲有關編碼解碼器的其他信息的 32 位值。該屬性從 ImageCodecFlags 枚舉返回若干標志的組合。
Version      //獲取或設置編碼解碼器的版本號。
SigMask      //獲取或設置可用作篩選器的二維字節數組。
SigPattern     //獲取或設置表示編碼解碼器簽名的二維字節數組。


  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved