IWMPCdrom::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
public void eject();
Public Sub eject()
Implements IWMPCdrom.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.
Examples
The following example uses eject to open the door of the CD or DVD drive that has the index of zero in response to the Click event of a button. The AxWMPLib.AxWindowsMediaPlayer object is represented by the variable named player.
private void ejectButton_Click(object o, System.EventArgs args)
{
player.cdromCollection.Item(0).eject();
}
Public Sub ejectButton_Click(ByVal o As Object, ByVal args As System.EventArgs) Handles ejectButton.Click
player.cdromCollection.Item(0).eject()
End Sub
Requirements
Requirement | Value |
---|---|
Version |
Windows Media Player 9 Series or later |
Namespace |
WMPLib |
Assembly |
|