Share via


Windows Media Player 11 SDK IWMPCdromCollection.Item (VB and C#) 

Windows Media Player SDK banner art

Previous Next

IWMPCdromCollection.Item (VB and C#)

The Item method returns an IWMPCdrom interface at the given index.

  

Parameters

lIndex

A System.Int32 that is the index.

Return Value

A WMPLib.IWMPCdrom interface.

Remarks

To use this method, read access to the library is required. For more information, see Library Access.

Example Code

The following example uses Item to display the drive specifier and playlist name from each CD available on the computer in a list box. If the drive actually contains DVD content, Windows XP or later is required. The AxWMPLib.AxWindowsMediaPlayer object is represented by the variable named player.

  
' Store the number of available drives.
Dim numDrives As Integer = player.cdromCollection.count

' Loop through the available drives.
For i As Integer = 0 To (numDrives - 1)

    ' Store the drive specifier and playlist name for this drive in a string.
    Dim pl As String = player.cdromCollection.Item(i).driveSpecifier + " "
    pl += player.cdromCollection.Item(i).Playlist.name

    ' Add the string to a list box.
    myPlaylists.Items.Add(pl)

Next i

FakePre-6fafdf32f5cf46cd8cbe55cc154b9826-09bc4dd90e1a43a2ad0f9d1e05aa2238

// Store the number of available drives.
int numDrives = player.cdromCollection.count;

// Loop through the available drives.
for (int i = 0; i < numDrives; i++)
{
    // Store the drive specifier and playlist name for this drive in a string.
    string pl = player.cdromCollection.Item(i).driveSpecifier + " ";
    pl += player.cdromCollection.Item(i).Playlist.name;

    // Add the string to a list box.
    myPlaylists.Items.Add(pl);
}

Requirements

Version: Windows Media Player 9 Series or later

Namespace: WMPLib

Assembly: Interop.WMPLib.dll (automatically generated by Visual Studio)

See Also

Previous Next