iWMDMDeviceControl::GetCapabilities 方法 (mswmdm.h)
GetCapabilities 方法检索设备功能,以确定设备可以执行的操作。 这些功能描述了媒体设备支持的设备控件的方法。
语法
HRESULT GetCapabilities(
[out] DWORD *pdwCapabilitiesMask
);
参数
[out] pdwCapabilitiesMask
指向指定设备功能的 DWORD 的指针。 可在此变量中返回以下标志。
标志 | 描述 |
---|---|
WMDM_DEVICECAP_CANPLAY | 媒体设备可以播放 MP3 音频。 |
WMDM_DEVICECAP_CANSTREAMPLAY | 媒体设备可以直接从主计算机播放流式处理音频。 |
WMDM_DEVICECAP_CANRECORD | 媒体设备可以录制音频。 |
WMDM_DEVICECAP_CANSTREAMRECORD | 媒体设备可以直接将流音频录制到主计算机。 |
WMDM_DEVICECAP_CANPAUSE | 媒体设备可以在播放或录制操作期间暂停。 |
WMDM_DEVICECAP_CANRESUME | 媒体设备可以恢复已暂停的操作。 |
WMDM_DEVICECAP_CANSTOP | 媒体设备可以在文件结束前停止播放。 |
WMDM_DEVICECAP_CANSEEK | 媒体设备可以查找文件开头以外的位置。 |
WMDM_DEVICECAP_HASSECURECLOCK | 媒体设备具有安全时钟。 |
返回值
该方法返回 HRESULT。 可能的值包括(但并不限于)下表中的项。
返回代码 | 说明 |
---|---|
|
方法成功。 |
|
pdwCapabilitiesMask 参数是无效或 NULL 指针。 |
|
发生了未指定的错误。 |
注解
目前,没有多少设备正确报告其功能。
示例
以下 C++ 代码检索设备功能。
// Examine the device capabilities.
// Use some of these to enable or disable the application's
// user interface elements.
CComQIPtr<IWMDMDeviceControl> pDeviceControl(pIWMDMDevice);
if (pDeviceControl != NULL)
{
DWORD caps = 0;
hr = pDeviceControl->GetCapabilities(&caps);
if (caps & WMDM_DEVICECAP_CANPLAY)
{
// TODO: Display a message indicating that the media device can play MP3 audio.
}
if (caps & WMDM_DEVICECAP_CANSTREAMPLAY)
{
// TODO: Display a message that the device can play audio directly from the host computer.
}
if (caps & WMDM_DEVICECAP_CANRECORD)
{
// TODO: Display a message that the device can record audio.
}
if (caps & WMDM_DEVICECAP_CANSTREAMRECORD)
{
// TODO: Display a message that the media device can record
// streaming audio directly to the host computer.
}
if (caps & WMDM_DEVICECAP_CANPAUSE)
{
// TODO: Display a message that the device can pause during play or record operations.
}
if (caps & WMDM_DEVICECAP_CANRESUME)
{
// TODO: Display a message that the device can resume an operation that was paused.
}
if (caps & WMDM_DEVICECAP_CANSTOP)
{
// TODO: Display a message that the device can stop playing before the end of a file.
}
if (caps & WMDM_DEVICECAP_CANSEEK)
{
// TODO: Display a message that the device can seek to a position
// other than the beginning of the file.
}
if (caps & WMDM_DEVICECAP_HASSECURECLOCK)
{
// TODO: Display a message indicating that the device has a secure clock.
}
}
要求
要求 | 值 |
---|---|
目标平台 | Windows |
标头 | mswmdm.h |
Library | Mssachlp.lib |