Share via


Windows Media Player 11 SDK IWMPCdromCollection.getByDriveSpecifier (VB and C#) 

Windows Media Player SDK banner art

Previous Next

IWMPCdromCollection.getByDriveSpecifier (VB and C#)

The getByDriveSpecifier method returns an IWMPCdrom interface associated with a particular drive letter.

  

Parameters

bstrDriveSpecifier

A System.String that is the drive letter followed by a colon (":") character.

Return Value

A WMPLib.IWMPCdrom interface.

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.

Example Code

The following example uses getByDriveSpecifier to get the IWMPCdrom interface that corresponds to a drive letter provided by the user in a text box. The IWMPCdrom.eject method is then called to eject the specified drive. The AxWMPLib.AxWindowsMediaPlayer object is represented by the variable named player.

  
' Store the drive letter provided by the user.
Dim driveLetter As String = myText.Text

' Append a colon to the drive letter to create a valid drive specifier.
driveLetter += ":"

' Get an IWMPCdrom interface for the drive.
Dim drive As WMPLib.IWMPCdrom = player.cdromCollection.getByDriveSpecifier(driveLetter)

' Use the eject method of the IWMPCdrom interface to open the drive door.
drive.eject()

FakePre-e4b7ba4854e048d08048d1e9657afe05-578f9823ad184b4b8b8267ae6aa2e6fb

// Store the drive letter provided by the user.
string driveLetter = myText.Text;

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

// Get an IWMPCdrom interface for the drive.
WMPLib.IWMPCdrom drive = player.cdromCollection.getByDriveSpecifier(driveLetter);

// Use the eject method of the IWMPCdrom interface to open the drive door.
drive.eject();

Requirements

Version: Windows Media Player 9 Series or later

Namespace: WMPLib

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

See Also

Previous Next