IWMPMedia::isReadOnlyItem 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 isReadOnlyItem method returns a value indicating whether the attributes of the specified media item can be edited.
public System.Boolean isReadOnlyItem(
System.String bstrItemName
);
Public Function isReadOnlyItem( _
ByVal bstrItemName As System.String _
) As System.Boolean
Implements IWMPMedia.isReadOnlyItem
-
bstrItemName [in]
-
A System.String that is the name of the media item.
A System.Boolean value that indicates whether the attributes are read-only.
If an attribute is read-only, then it cannot be set with the setItemInfo method. Note that this method may return different values for a particular attribute when used with different versions of Windows Media Player.
Before calling this method, you must have read access to the library. For more information, see Library Access.
The following example uses isReadOnlyItem to fill a multi-line text box with information about the current media item. The code displays each attribute of the current media item, along with text indicating whether the attribute is read-only or read/write. The AxWMPLib.AxWindowsMediaPlayer object is represented by the variable named player.
// Store a WMPLib.IWMPMedia3 interface to the current media item.
WMPLib.IWMPMedia3 cm = (WMPLib.IWMPMedia3)player.currentMedia;
// Get the number of attributes in the current media item.
int attCount = player.currentMedia.attributeCount;
// Create an array to store the list of attribute information.
string[] atInfo = new string[attCount];
// Create a variable to hold each attribute name.
string atName;
// Loop through the attribute list.
for (int i = 0; i < cm.attributeCount; i++)
{
// Get the attribute name.
atName = cm.getAttributeName(i);
// Test whether the attribute is read-only.
string test = ((cm.isReadOnlyItem(atName)) ? "Read-Only" : "Read/Write");
// Store the attribute information in the array.
atInfo[i] = (atName + " is " + test);
}
// Display the attribute information in the text box.
rwText.Lines = atInfo;
' Store a WMPLib.IWMPMedia3 interface to the current media item.
Dim cm As WMPLib.IWMPMedia3 = player.currentMedia
' Get the number of attributes in the current media item.
Dim attCount As Integer = player.currentMedia.attributeCount
' Create an array to store the list of attribute information.
Dim atInfo(attCount) As String
' Create a variable to hold each attribute name.
Dim atName As String
' Loop through the attribute list.
For i As Integer = 0 To (cm.attributeCount - 1)
' Get the attribute name.
atName = cm.getAttributeName(i)
' Test whether the attribute is read-only.
If (cm.isReadOnlyItem(atName)) Then
atInfo(i) = (atName + " is Read-Only")
Else
atInfo(i) = (atName + " is Read/Write")
End If
Next i
' Display the attribute information in the text box.
rwText.Lines = atInfo
Requirement | Value |
---|---|
Version |
Windows Media Player 9 Series or later |
Namespace |
WMPLib |
Assembly |
|