Bagikan melalui


Metode IWMDMDeviceControl::GetCapabilities (mswmdm.h)

Metode GetCapabilities mengambil kemampuan perangkat untuk menentukan operasi apa yang dapat dilakukan perangkat. Kemampuan menjelaskan metode kontrol perangkat yang didukung oleh perangkat media.

Sintaks

HRESULT GetCapabilities(
  [out] DWORD *pdwCapabilitiesMask
);

Parameter

[out] pdwCapabilitiesMask

Arahkan ke DWORD yang menentukan kemampuan perangkat. Bendera berikut dapat dikembalikan dalam variabel ini.

Bendera Deskripsi
WMDM_DEVICECAP_CANPLAY Perangkat media dapat memutar audio MP3.
WMDM_DEVICECAP_CANSTREAMPLAY Perangkat media dapat memutar audio streaming langsung dari komputer host.
WMDM_DEVICECAP_CANRECORD Perangkat media dapat merekam audio.
WMDM_DEVICECAP_CANSTREAMRECORD Perangkat media dapat merekam streaming audio langsung ke komputer host.
WMDM_DEVICECAP_CANPAUSE Perangkat media dapat dijeda selama operasi putar atau rekam.
WMDM_DEVICECAP_CANRESUME Perangkat media dapat melanjutkan operasi yang dijeda.
WMDM_DEVICECAP_CANSTOP Perangkat media bisa berhenti diputar sebelum akhir berkas.
WMDM_DEVICECAP_CANSEEK Perangkat media dapat mencari posisi selain awal file.
WMDM_DEVICECAP_HASSECURECLOCK Perangkat media memiliki jam yang aman.

Nilai kembali

Metode mengembalikan HRESULT. Nilai yang mungkin termasuk, tetapi tidak terbatas pada, yang ada dalam tabel berikut.

Menampilkan kode Deskripsi
S_OK
Metode berhasil.
E_INVALIDARG
Parameter pdwCapabilitiesMask adalah penunjuk NULL atau tidak valid.
E_FAIL
Terjadi kesalahan yang tidak ditentukan.

Keterangan

Saat ini, tidak banyak perangkat yang melaporkan kemampuannya dengan benar.

Contoh

Kode C++ berikut mengambil kemampuan perangkat.


// 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.
    }
}

Persyaratan

Persyaratan Nilai
Target Platform Windows
Header mswmdm.h
Pustaka Mssachlp.lib

Lihat juga

Antarmuka IWMDMDeviceControl

Antarmuka IWMDMObjectInfo