检索翻录接口
[与此页面关联的功能(Windows 媒体播放器 SDK)是旧版功能。 它已被 MediaPlayer 取代。 MediaPlayer 已针对Windows 10和Windows 11进行了优化。 Microsoft 强烈建议新代码尽可能使用 MediaPlayer 而不是 Windows 媒体播放器 SDK。 如果可能,Microsoft 建议重写使用旧 API 的现有代码以使用新 API。]
若要枚举用户计算机上的 CD 驱动器,请使用 IWMPCdromCollection 接口。 通过调用 IWMPCore::get_cdromCollection 检索指向此接口的指针。
通过使用 get_count 和 项 方法,可以循环访问集合以检索用户计算机上的每个 CD 驱动器的 IWMPCdrom 接口。
IWMPCdrom 接口表示单个 CD 驱动器。 在开始翻录 CD 之前,必须先通过 IWMPCdrom 指针调用 QueryInterface 以检索 IWMPCdromRip 接口。
下面的代码示例演示如何检索接口以从特定驱动器中翻录 CD:
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;
}
相关主题
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈