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 |