Windows Media Player 11 SDK IWMPMedia.getAttributeName (VB and C#)
Previous | Next |
IWMPMedia.getAttributeName (VB and C#)
The getAttributeName method returns the name of the attribute corresponding to the specified index.
[Visual Basic] Function getAttributeName( lIndex As Integer ) As String [C#] string getAttributeName ( int lIndex );
Parameters
lIndex
A System.Int32 that is the index.
Return Value
A System.String that is the attribute name.
Remarks
The attribute name returned can be used in conjunction with getItemInfo to retrieve the value for a specific named attribute.
Before calling this method, you must have read access to the library. For more information, see Library Access.
For information about the attributes supported by Windows Media Player, see the Attribute Reference.
Example Code
The following example uses getAttributeName to fill a multi-line text box with the index and name of each attribute for the current media item. The AxWMPLib.AxWindowsMediaPlayer object is represented by the variable named player.
[Visual Basic]
' Store an IWMPMedia3 interface for the current media item. Dim cm As WMPLib.IWMPMedia3 = player.currentMedia ' Get the number of attributes for the current media. Dim attCount As Integer = cm.attributeCount ' Create an array of strings to hold the index and name for each attribute. Dim attInfo(attCount) As String ' Loop through the attribute list. For i As Integer = 0 To (attCount - 1) ' Store the attribute index and name in the array. attInfo(i) = ("Attribute " + i.ToString() + ": " + cm.getAttributeName(i)) Next i ' Display the attribute information in the text box. attributeNames.Lines = attInfo
FakePre-844088e652ec4104998b690ccdbe7aa7-6f21c2701cf54389bd7ce0152d6c9caa
// Store an IWMPMedia3 interface for the current media item. WMPLib.IWMPMedia3 cm = (WMPLib.IWMPMedia3)player.currentMedia; // Get the number of attributes for the current media item. int attCount = cm.attributeCount; // Create an array of strings to hold the index and name for each attribute. string[] attInfo = new string[attCount]; // Loop through the attribute list. for (int i = 0; i < attCount; i++) { // Store the attribute index and name in the array. attInfo[i] = ("Attribute " + i + ": " + cm.getAttributeName(i)); } // Display the attribute information in the text box. attributeNames.Lines = attInfo;
Requirements
Version: Windows Media Player 9 Series or later
Namespace: WMPLib
Assembly: Interop.WMPLib.dll (automatically generated by Visual Studio)
See Also
Previous | Next |