Share via


Retrieving the Ripping Interface

[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.]

To enumerate the CD drives on the user's computer, use the IWMPCdromCollection interface. Retrieve a pointer to this interface by calling IWMPCore::get_cdromCollection.

By using the get_count and item methods, you can iterate the collection to retrieve an IWMPCdrom interface for each CD drive on the user's computer.

The IWMPCdrom interface represents an individual CD drive. Before you begin ripping a CD, you must first call QueryInterface through an IWMPCdrom pointer to retrieve the IWMPCdromRip interface.

The following code example demonstrates how to retrieve an interface for ripping a CD from a specific drive:

HRESULT CMainDlg::GetCdromDriveCount (long &lDriveCount)
{
    HRESULT hr = m_spPlayer->get_cdromCollection(&m_spCdromCollection);

    // Get the number of CDROM drives.
    if (SUCCEEDED(hr))
    {
        hr = m_spCdromCollection->get_count(&lDriveCount);
    }

    return hr;
}

// lIndex refers to the index of the current drive,
// which must be less than the value retrieved by
// GetCdromDriveCount above.
HRESULT CMainDlg::GetCdromRipInterface (long lIndex)
{
    // Get the IWMPCdrom interface.
    m_spCdrom.Release();
    HRESULT hr = m_spCdromCollection->item(lIndex, &m_spCdrom);
    if (SUCCEEDED(hr))
    {
        // Get the IWMPCdromRip interface.
        m_spCdromRip.Release();
        hr = m_spCdrom->QueryInterface(&m_spCdromRip);
    }

    return hr;
}

Ripping a CD

Starting the Rip Process

Retrieving the Rip Status

Selecting Items for Ripping

IWMPCdromCollection Interface