Gambar::Metode GetPropertyIdList (gdiplusheaders.h)

Metode Image::GetPropertyIdList mendapatkan daftar pengidentifikasi properti yang digunakan dalam metadata objek Gambar ini.

Sintaks

Status GetPropertyIdList(
  [in]  UINT   numOfProperty,
  [out] PROPID *list
);

Parameter

[in] numOfProperty

Jenis: UINT

Bilangan bulat yang menentukan jumlah elemen dalam array daftar . Panggil metode Image::GetPropertyCount untuk menentukan nomor ini.

[out] list

Jenis: PROPID*

Penunjuk ke array yang menerima pengidentifikasi properti.

Nilai kembali

Jenis: Status

Jika metode berhasil, metode mengembalikan Ok, yang merupakan elemen dari enumerasi Status .

Jika metode gagal, metode mengembalikan salah satu elemen lain dari enumerasi Status .

Keterangan

Metode Image::GetPropertyIdList mengembalikan array PROPIDs. Sebelum Anda memanggil Image::GetPropertyIdList, Anda harus mengalokasikan buffer yang cukup besar untuk menerima array tersebut. Anda dapat memanggil metode Image::GetPropertyCount dari objek Image untuk menentukan ukuran buffer yang diperlukan. Ukuran buffer harus menjadi nilai yang dikembalikan dari Image::GetPropertyCount dikalikan dengan sizeof( PROPID).

Contoh

Contoh berikut membuat objek Gambar berdasarkan file JPEG. Kode memanggil metode Image::GetPropertyIdList dari objek Image tersebut untuk mengetahui jenis metadata apa yang disimpan dalam gambar.

#include <windows.h>
#include <gdiplus.h>
#include <stdio.h>
using namespace Gdiplus;

INT main()
{
   GdiplusStartupInput gdiplusStartupInput;
   ULONG_PTR gdiplusToken;
   GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);

   UINT count = 0; 
   Image* image = new Image(L"FakePhoto.jpg");

   // How many types of metadata are in the image?
   count = image->GetPropertyCount();
   if(count == 0)
      return 0;

   // Allocate a buffer to receive an array of PROPIDs.
   PROPID* propIDs = new PROPID[count];

   image->GetPropertyIdList(count, propIDs);

   // List the retrieved IDs.
   for(UINT j = 0; j < count; ++j)
      printf("%x\n", propIDs[j]);

   delete [] propIDs;
   delete image;   
  
   GdiplusShutdown(gdiplusToken);
   return 0;
}

Kode sebelumnya, bersama dengan file tertentu, FakePhoto.jpg, menghasilkan output berikut:

320
10f
110
9003
829a
5090
5091

Output sebelumnya menunjukkan nilai heksadesimal dari setiap pengidentifikasi properti. Anda dapat mencari angka-angka tersebut di Gdiplusimaging.h dan mencari tahu bahwa angka tersebut mewakili tag properti berikut.

Nilai heksadesimal Tag properti
0x0320 PropertyTagImageTitle
0x010f PropertyTagEquipMake
0x0110 PropertyTagEquipModel
0x9003 PropertyTagExifDTOriginal
0x829a PropertyTagExifExposureTime
0x5090 PropertyTagLuminanceTable
0x5091 PropertyTagChrominanceTable
 

Persyaratan

Persyaratan Nilai
Klien minimum yang didukung Windows XP, Windows 2000 Professional [hanya aplikasi desktop]
Server minimum yang didukung Windows 2000 Server [hanya aplikasi desktop]
Target Platform Windows
Header gdiplusheaders.h (termasuk Gdiplus.h)
Pustaka Gdiplus.lib
DLL Gdiplus.dll

Lihat juga

Gambar

Gambar::GetAllPropertyItems

Gambar::GetPropertyCount

Gambar::GetPropertyItem

Gambar::GetPropertyItemSize

Gambar::GetPropertySize

Gambar::RemovePropertyItem

Gambar::SetPropertyItem

PropertyItem

Membaca dan Menulis Metadata