Κοινή χρήση μέσω


CdromCollection.getByDriveSpecifier 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 getByDriveSpecifier method retrieves the Cdrom object associated with a particular drive letter.

Syntax

retVal = CdromCollection.getByDriveSpecifier(
  driveSpecifier
)

Parameters

driveSpecifier [in]

String containing the drive letter followed by a colon (":") character.

Return value

This method returns a Cdrom object.

Remarks

Drive letters must be given in the form X:, where X represents the drive letter.

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

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

Examples

The following JScript example uses CdromCollection.getByDriveSpecifier to retrieve the Cdrom object that corresponds to a drive letter provided by the user. An HTML text element was created, with NAME = "MyText", for user input. The Player object was created with ID = "Player".

// Store the drive letter provided by the user.
var DriveLetter = MyText.value;

// Append a colon to the drive letter to create a valid drive specifier.
DriveLetter += ":";

// Get the Cdrom object using the drive specifier.
var Drive = Player.cdRomCollection.getByDriveSpecifier(DriveLetter);

// Use the Cdrom object to open the drive door.
Drive.eject();

Requirements

Requirement Value
Version
Windows Media Player version 7.0 or later.
DLL
Wmp.dll

See also

Cdrom Object

Cdrom.eject

CdromCollection Object

Settings.mediaAccessRights

Settings.requestMediaAccessRights