Compartir a través de


IWMPMedia::getItemInfo method (wmp.h)

[The feature associated with this page, Windows Media Player SDK, is a legacy feature. It has been superseded by MediaPlayer. MediaPlayer has been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use MediaPlayer instead of Windows Media Player SDK, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]

The getItemInfo method retrieves the value of the specified attribute for the media item.

Syntax

HRESULT getItemInfo(
  [in]  BSTR bstrItemName,
  [out] BSTR *pbstrVal
);

Parameters

[in] bstrItemName

BSTR containing the item name.

[out] pbstrVal

Pointer to a BSTR containing the returned value.

Return value

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

Return code Description
S_OK
The method succeeded.

Remarks

This method retrieves the metadata for an individual media item or a media item that is part of a playlist.

The get_attributeCount method retrieves the number of attribute names available for a given media item. Index numbers can then be used with the getAttributeName method to determine the name of each available attribute. Individual attribute names can be passed to getItemInfo.

To retrieve attributes with multiple values and attributes with complex values, use the getItemInfoByType method.

The set of attributes available from sources other than the local library (remote libraries, portable devices, or CDs) is defined by the other sources.

Before calling this method, you must have Read access to the library. For more information, see Library Access.

To share the Windows media libraries over UPnP, Windows Media Player creates a content directory service (CDS) that

is exposed over UPnP. Other devices can then navigate and browse the libraries.

In Windows 7, an application can use the Windows Media Player TrackingID and MediaType attributes to construct the object ID of each item in the CDS. Note that this construction might change in future versions of Windows. The application passes each of these attribute strings in the bstrItemName parameter in a call to getItemInfo. getItemInfo returns the value for each attribute in a variable to which the pbstrVal parameter points. The application then uses the following syntax to construct each object ID:

TrackingID.0.MediaTypeID

This syntax has the following meaning:

  • TrackingID is the string that is stored in the Windows Media Player TrackingID attribute of the media item.
  • MediaTypeID depends on the value of the MediaType

    attribute, as shown in the following table:

    MediaType attribute MediaTypeID
    Audio Items 4
    Photo Items B
    Video Items 8
     
Windows Media Player 10 Mobile: Attributes for a media item are available only during playback unless they are retrieved from the item through the media collection.

Requirements

Requirement Value
Minimum supported client Windows Media Player 9 Series or later.
Target Platform Windows
Header wmp.h
DLL Wmp.dll

See also

Attribute Reference

IWMPMedia Interface

IWMPMedia3::getItemInfoByType

IWMPMedia::getAttributeName

IWMPMedia::get_attributeCount

IWMPMedia::setItemInfo