Share via


Windows Media Player 11 SDK IWMPCdrom.driveSpecifier (VB and C#) 

Windows Media Player SDK banner art

Previous Next

IWMPCdrom.driveSpecifier (VB and C#)

The driveSpecifier property gets the CD or DVD drive letter.

  

Property Value

A System.String that is the drive letter.

Remarks

Typically, DVD drives can play CD media, but CD drives cannot play DVD media.

This property gets a drive letter for a zero-based drive index within the range retrieved using IWMPCdromCollection.count. The value retrieved takes the form X:, where X represents the drive letter.

To retrieve the value of this property, read access to the library is required. For more information, see Library Access.

Example Code

The following example uses driveSpecifier to build a string that contains a list of available CD and DVD drives and displays that string in a message box. The AxWMPLib.AxWindowsMediaPlayer object is represented by the variable named player.

  
'  String that will contain the list of drive specifiers.
Dim MyDriveSpecifiers As String = "Drive letters found:  "

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

'  Loop through the available drives. 
For i As Integer = 0 To (numDrives - 1)
    MyDriveSpecifiers += player.cdromCollection.Item(i).driveSpecifier
    MyDriveSpecifiers += " "
Next i

'  Display the list of drive specifiers in a message box.
System.Windows.Forms.MessageBox.Show(MyDriveSpecifiers)

FakePre-190392f92d44443d9bc23ae78dd62048-da189863bdf745ada6ad3835a98f3dc1

// String that will contain the list of drive specifiers.
string MyDriveSpecifiers = "Drive letters found:  ";

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

// Loop through the available drives. 
for (int i = 0; i < numDrives; i++)
{
    MyDriveSpecifiers += player.cdromCollection.Item(i).driveSpecifier;
    MyDriveSpecifiers += " ";
}

// Display the list of drive specifiers in a message box.
System.Windows.Forms.MessageBox.Show(MyDriveSpecifiers);

Requirements

Version: Windows Media Player 9 Series or later

Namespace: WMPLib

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

See Also

Previous Next