IWMPCdromCollection :: getByDriveSpecifier, méthode
La méthode getByDriveSpecifier retourne une interface IWMPCdrom associée à une lettre de lecteur particulière.
Syntaxe
public IWMPCdrom getByDriveSpecifier(
System.String bstrDriveSpecifier
);
Public Function getByDriveSpecifier( _
ByVal bstrDriveSpecifier As System.String _
) As IWMPCdrom
Implements IWMPCdromCollection.getByDriveSpecifier
Paramètres
-
bstrDriveSpecifier [ dans]
-
System. String qui est la lettre de lecteur suivie d’un signe deux-points (« : »).
Valeur de retour
Interface wmplib. IWMPCdrom .
Notes
Les lettres de lecteur doivent être indiquées sous la forme x:, où x représente la lettre de lecteur.
Pour utiliser cette méthode, l’accès en lecture à la bibliothèque est requis. Pour plus d’informations, consultez accès à la bibliothèque.
Exemples
L’exemple suivant utilise getByDriveSpecifier pour obtenir l’interface IWMPCdrom qui correspond à une lettre de lecteur fournie par l’utilisateur dans une zone de texte. La méthode IWMPCdrom. EJECT est ensuite appelée pour éjecter le lecteur spécifié. L’objet AxWMPLib. AxWindowsMediaPlayer est représenté par la variable Player.
// 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();
' 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()
Spécifications
| Condition requise | Valeur |
|---|---|
| Version |
Lecteur Windows Media série 9 ou version ultérieure |
| Espace de noms |
WMPLib |
| Assembly |
|