IWMPMedia::attributeCount-Eigenschaft

Die attributeCount-Eigenschaft ruft die Anzahl der Attribute ab, die für das Medienelement abgefragt und/oder festgelegt werden können.

Diese Eigenschaft ist schreibgeschützt.

Syntax

public System.Int32 attributeCount {get;}

Public ReadOnly Property attributeCount As System.Int32

Eigenschaftswert

Eine System.Int32-Datei, die der Anzahl entspricht.

Bemerkungen

Bevor Sie diese Eigenschaft verwenden können, benötigen Sie Lesezugriff auf die Bibliothek. Weitere Informationen finden Sie unter Bibliothekszugriff.

Informationen zu den attributen, die von Windows Media Player unterstützt werden, finden Sie unter Attributverweis.

Beispiele

Im folgenden Beispiel wird attributeCount verwendet, um die Anzahl der im aktuellen Medienelement verfügbaren Attribute zu bestimmen. Der Code verwendet diesen Wert, um eine Liste von Attributnamen und -werten in einem Textfeld anzuzeigen. Das AxWMPLib.AxWindowsMediaPlayer-Objekt wird durch die Variable player dargestellt.

// Store an IWMPMedia3 interface to the current media item. 
WMPLib.IWMPMedia3 cm = (WMPLib.IWMPMedia3)player.currentMedia;

// Store the number of attributes in the current media item using attributeCount.
int numAttributes = cm.attributeCount;

// Create strings to hold each attribute name and value.
string atName;
string atValue;

// Create an array to hold the attribute list.
string [] atList = new string[numAttributes];

// Loop through the attribute list.   
for (int i = 0; i < numAttributes; i++)
{
    // Fill the strings with the attribute information.
    atName = cm.getAttributeName(i);
    atValue = cm.getItemInfo(atName);

    // Store the attribute information in an array.
    atList[i] = (atName + ": " + atValue);
}

// Display the attribute information in the text box.
attributeList.Lines = atList;

' Store an IWMPMedia3 interface to the current media item. 
Dim cm As WMPLib.IWMPMedia3 = player.currentMedia

&#39; Store the number of attributes in the current media item using attributeCount.
Dim numAttributes As Integer = cm.attributeCount

&#39; Create strings to hold each attribute name and value.
Dim atName As String
Dim atValue As String

&#39; Create an array to hold the attribute list.
Dim atList(numAttributes) As String

&#39; Loop through the attribute list.   
For i As Integer = 0 To (numAttributes - 1)

    &#39; Fill the strings with the attribute information.
    atName = cm.getAttributeName(i)
    atValue = cm.getItemInfo(atName)

    &#39; Store the attribute information in an array.
    atList(i) = (atName + &quot;: &quot; + atValue)

Next i

&#39; Display the attribute information in the text box.
attributeList.Lines = atList

Requirements (Anforderungen)

Anforderung Wert
Version
Windows Media Player 9er Serie oder höher
Namespace
WMPLib
Assembly
Interop.WMPLib.dll (Interop.WMPLib.dll.dll)

Weitere Informationen

IWMPMedia-Schnittstelle (VB und C#)