共用方式為


IWMPStringCollection2::getItemInfobyType method

[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 getItemInfoByType method returns the value corresponding to the specified string collection item index, name, language, and attribute index.

Syntax

public System.Object getItemInfobyType(
  System.Int32 lCollectionIndex,
  System.String bstrType,
  System.String bstrLanguage,
  System.Int32 lAttributeIndex
);

Public Function getItemInfobyType( _
  ByVal lCollectionIndex As System.Int32, _
  ByVal bstrType As System.String, _
  ByVal bstrLanguage As System.String, _
  ByVal lAttributeIndex As System.Int32 _
) As System.Object
Implements IWMPStringCollection2.getItemInfobyType

Parameters

lCollectionIndex [in]

The System.Int32 that is the zero-based index of the string collection item from which to get the attribute.

bstrType [in]

The System.String that is the attribute name.

bstrLanguage [in]

The System.String that indicates the language. If the value is set to null or to a zero-length string (""), the current locale string is used. Otherwise, the value must be a valid RFC 1766 language string such as "en-us".

lAttributeIndex [in]

A System.Int32 that is the zero-based index of the attribute.

Return value

A System.Object that is the string collection item.

Remarks

This method supports attributes with multiple values and attributes with complex values. The getItemInfo method does not support attributes with multiple values or attributes with complex values.

By passing the value "ChildList" in the bstrType parameter, you can retrieve a new string collection that contains the children of one of the items in the parent string collection. For instance, if the parent collection contains a list of AlbumIDs, you can use this method to obtain a child string collection that contains all the tracks for one of the albums. This approach is faster and more efficient than calling the IWMPMediaCollection2.getStringCollectionByQuery method twice; once to get a collection of AlbumIDs, and a second time to get a collection of tracks for a particular AlbumID. To use ChildList in the way just described, the parent string collection must be obtained from a media collection through IWMPLibraryServices, and not by using the AxWindowsMediaPlayer.mediaCollection property.

When using ChildList, pass the value "ChildList" in the bstrType parameter, and the value 0 in the lAttributeIndex parameter. You can then cast the object that is returned to an IWMPStringCollection2 interface to access the child list.

To use this method, you must have read access to the library. For more information, see Library Access.

Requirements

Requirement Value
Version
Windows Media Player 11.
Namespace
WMPLib
Assembly
Interop.WMPLib.dll (Interop.WMPLib.dll.dll)

See also

AlbumID Attribute

IWMPLibraryServices Interface (VB and C#)

IWMPMediaCollection2.getStringCollectionByQuery (VB and C#)

IWMPStringCollection2 Interface

IWMPStringCollection2.getItemInfo (VB and C#)