Compartir a través de


IWMPCdromCollection::count property

[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 count property gets the number of available CD and DVD drives on the system.

Syntax

public System.Int32 count {get; set;}

Public ReadOnly Property count As System.Int32

Property value

A System.Int32 that is the count of available drives.

Remarks

To retrieve the value of this property, read access to the library is required. For more information, see Library Access.

DVD drives are counted exactly like CD drives. However, the Windows Media Player ActiveX control only supports DVD functionality for Windows XP or later. Typically, DVD drives can play CD media, but CD drives cannot play DVD media.

Examples

The following example uses count to display the number of available CD and DVD drives in a message box. The AxWMPLib.AxWindowsMediaPlayer object is represented by the variable named player.

// Store the number of available drives.
int numDrives = player.cdromCollection.count;

// Display the number of drives as a string.
System.Windows.Forms.MessageBox.Show("Number of available CD and DVD drives:  " + numDrives.ToString());

' Store the number of available drives.
Dim numDrives As Integer = player.cdromCollection.count

' Display the number of drives as a string.
System.Windows.Forms.MessageBox.Show("Number of available CD and DVD drives:  " + numDrives.ToString())

Requirements

Requirement Value
Version
Windows Media Player 9 Series or later
Namespace
WMPLib
Assembly
Interop.WMPLib.dll (Interop.WMPLib.dll.dll)

See also

IWMPCdromCollection Interface (VB and C#)

IWMPSettings2.mediaAccessRights (VB and C#)

IWMPSettings2.requestMediaAccessRights (VB and C#)