Compartir a través de


Cdrom.eject 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 eject method ejects the CD or DVD from the drive.

Syntax

Cdrom.eject()

Parameters

This method has no parameters.

Return value

This method does not return a value.

Remarks

If the drive door is open, this method closes the door.

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 example creates an HTML button element that uses Cdrom.eject to open the door of the drive that has drive specifier index zero. The Player object was created with ID = "Player".

<INPUT TYPE = "BUTTON"
       NAME = "EJECTBUTTON"
       VALUE = "EJECT"
       OnClick =  "Player.cdromCollection.item(0).eject()"
>

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

Player.playState

Settings.mediaAccessRights

Settings.requestMediaAccessRights