Retrieving the CD Burning 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. You 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 pointer for each CD drive on the user's computer.

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

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

HRESULT CMainDlg::GetCdromDriveCount (long &lDriveCount)
{
    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::GetCdromBurnInterface (long lIndex)
{
    // Get the IWMPCdrom interface.
    m_spCdrom.Release();
    HRESULT hr = m_spCdromCollection->item(lIndex, &m_spCdrom);
    if (SUCCEEDED(hr))
    {
        // Get the IWMPCdromBurn interface.
        m_spCdromBurn.Release();
        hr = m_spCdrom->QueryInterface(&m_spCdromBurn);
    }

    return hr;
}

Burning a CD

Starting the Burn Process

Erasing a Rewritable CD

Retrieving the Drive and Disc Status

Retrieving the Burn Status

IWMPCdromCollection Interface