Compartir a través de


Cdrom.driveSpecifier

[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 driveSpecifier property retrieves the CD or DVD drive letter.

player.cdromCollection.item(
        index
        ).driveSpecifier
      

Possible Values

This property is a read-only String.

Remarks

Typically, DVD drives can play CD media, but CD drives cannot play DVD media. This property retrieves a drive specifier for a zero-based drive index within the range retrieved using CdromCollection.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.

Windows Media Player 10 Mobile: This property is not supported.

Examples

The following JScript example uses Cdrom.driveSpecifier to fill an HTML text area named myText with a comma-separated list of available CD and DVD drives. The Player object was created with ID = "Player".

// Allocate an array to store the drive specifiers.
var MYdriveSpecifiers = new Array();

// Loop through the available drives using CdromCollection.count.
for (var i = 0; i < Player.cdRomCollection.count; i++){

// For each available drive, add a corresponding item 
// to the MYdriveSpecifiers array. 
    MYdriveSpecifiers[i] = Player.CDRomCollection.item(i).driveSpecifier;
}

// Write the array of drive letter specifiers to the text area.
myText.value = "Drive letters found: " + MYdriveSpecifiers;

Requirements

Requirement Value
Minimum supported client
Windows XP [desktop apps only]
Minimum supported server
Windows Server 2003 [desktop apps only]
Version
Windows Media Player version 7.0 or later
DLL
Wmp.dll

See also

Cdrom Object

CdromCollection.count

Settings.mediaAccessRights

Settings.requestMediaAccessRights