Windows apps
Collapse the table of content
Expand the table of content
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

IMFAttributes::GetItemByIndex method

Retrieves an attribute at the specified index.


HRESULT GetItemByIndex(
  [in]      UINT32      unIndex,
  [out]     GUID        *pguidKey,
  [in, out] PROPVARIANT *pValue


unIndex [in]

Index of the attribute to retrieve. To get the number of attributes, call IMFAttributes::GetCount.

pguidKey [out]

Receives the GUID that identifies this attribute.

pValue [in, out]

Pointer to a PROPVARIANT that receives the value. This parameter can be NULL. If it is not NULL, the method fills the PROPVARIANT with a copy of the attribute value. Call PropVariantClear to free the memory allocated by this method.

Return value

The method returns an HRESULT. Possible values include, but are not limited to, those in the following table.

Return codeDescription

The method succeeded.


Invalid index.



To enumerate all of an object's attributes in a thread-safe way, do the following:

  1. Call IMFAttributes::LockStore to prevent another thread from adding or deleting attributes.

  2. Call IMFAttributes::GetCount to find the number of attributes.

  3. Call GetItemByIndex to get each attribute by index.

  4. Call IMFAttributes::UnlockStore to unlock the attribute store.

This interface is available on the following platforms if the Windows Media Format 11 SDK redistributable components are installed:

  • Windows XP with Service Pack 2 (SP2) and later.
  • Windows XP Media Center Edition 2005 with KB900325 (Windows XP Media Center Edition 2005) and KB925766 (October 2006 Update Rollup for Windows XP Media Center Edition) installed.


Minimum supported client

Windows Vista [desktop apps | UWP apps]

Minimum supported server

Windows Server 2008 [desktop apps | UWP apps]


Mfobjects.h (include Mfidl.h)



See also

Attributes and Properties



© 2018 Microsoft