Image::GetPropertyIdList 方法 (gdiplusheaders.h)

Image::GetPropertyIdList 方法會取得這個 Image 物件元數據中使用的屬性標識符清單。

語法

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

參數

[in] numOfProperty

類型: UINT

整數,指定 清單 陣列中的項目數目。 呼叫 Image::GetPropertyCount 方法來判斷此數位。

[out] list

類型: PROPID*

接收屬性識別碼之陣列的指標。

傳回值

類型: 狀態

如果方法成功,它會傳回Ok,這是 Status 列舉的元素。

如果方法失敗,它會傳回 Status 列舉的其他其中一個專案。

備註

Image::GetPropertyIdList 方法會傳回 PROPID的陣列。 呼叫 Image::GetPropertyIdList 之前,您必須配置足以接收該數位的緩衝區。 您可以呼叫 Image 物件的 Image::GetPropertyCount 方法,以判斷所需緩衝區的大小。 緩衝區的大小應該是 Image::GetPropertyCount 的傳回值,乘以 sizeof ( PROPID) 。

範例

下列範例會根據 JPEG 檔案建立 Image 物件。 程序代碼會呼叫該 Image 物件的 Image::GetPropertyIdList 方法,以找出影像中儲存的元數據類型。

#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;
}

上述程式代碼以及特定檔案 FakePhoto.jpg 會產生下列輸出:

320
10f
110
9003
829a
5090
5091

上述輸出會顯示每個屬性識別碼的十六進位值。 您可以在 Gdiplusimaging.h 中查閱這些數位,並找出它們代表下列屬性標記。

十六進位值 屬性標籤
0x0320 PropertyTagImageTitle
0x010f PropertyTagEquipMake
0x0110 PropertyTagEquipModel
0x9003 PropertyTagExifDTOriginal
0x829a PropertyTagExifExposureTime
0x5090 PropertyTagLuminanceTable
0x5091 PropertyTagChrominanceTable
 

規格需求

需求
最低支援的用戶端 Windows XP、Windows 2000 Professional [僅限桌面應用程式]
最低支援的伺服器 Windows 2000 Server [僅限桌面應用程式]
目標平台 Windows
標頭 gdiplusheaders.h (包含 Gdiplus.h)
程式庫 Gdiplus.lib
Dll Gdiplus.dll

另請參閱

映像

Image::GetAllPropertyItems

Image::GetPropertyCount

Image::GetPropertyItem

Image::GetPropertyItemSize

Image::GetPropertySize

Image::RemovePropertyItem

Image::SetPropertyItem

PropertyItem

讀取和寫入元數據