IWMDMDevice3::GetProperty 메서드(mswmdm.h)

GetProperty 메서드는 특정 디바이스 메타데이터 속성을 검색합니다.

구문

HRESULT GetProperty(
  [in]  LPCWSTR     pwszPropName,
  [out] PROPVARIANT *pValue
);

매개 변수

[in] pwszPropName

검색할 속성의 null로 끝나는 넓은 문자열 이름입니다. 표준 속성 이름 상수 목록은 메타데이터 상수에 제공됩니다.

[out] pValue

속성에 대해 반환된 값입니다. 애플리케이션은 PropVariantClear를 사용하여 이 메모리를 해제해야 합니다.

반환 값

이 메서드는 HRESULT를 반환합니다. Windows Media 장치 관리자 모든 인터페이스 메서드는 다음 오류 코드 클래스 중 어느 것을 반환할 수 있습니다.

  • 표준 COM 오류 코드
  • HRESULT 값으로 변환된 Windows 오류 코드
  • Windows Media 장치 관리자 오류 코드
가능한 오류 코드의 광범위한 목록은 오류 코드를 참조하세요.

설명

지원되는 디바이스 속성 목록을 가져오려면 클라이언트가 이 함수를 호출하고 g_wszWMDMSupportedDeviceProperties 지정합니다. 표준 디바이스 속성 이름 목록은 메타데이터 상수를 참조하세요.

클라이언트는 pValue 매개 변수의 빈 PROPVARIANT에 대한 포인터를 전달해야 합니다. 반환 시 pValue 에는 속성 값이 포함됩니다.

이 메서드는 스토리지에 대한 GetMetadataGetSpecifiedMetadata 메서드와 유사하지만 이 메서드는 한 번에 하나의 속성만 가져올 수 있습니다.

예제

다음 C++ 코드는 디바이스에서 지원하는 형식의 SAFEARRAY 목록을 반환하는 g_wszWMDMFormatsSupported 속성에 대해 쿼리합니다.


// Query a device for supported configurations for each media or format type. 
HRESULT GetCaps(IWMDMDevice3* pDevice)
{
    HRESULT hr = S_OK;

    // Request the "formats supported" property to get a list of supported formats.
    PROPVARIANT pvFormatsSupported;
    PropVariantInit(&pvFormatsSupported);
    hr = pDevice->GetProperty(g_wszWMDMFormatsSupported, &pvFormatsSupported);
    HANDLE_HR(hr, "Got a property list in GetCaps", "Couldn't get a property list in GetCaps.");

    // Loop through the retrieved format list.
    // For each format, get a list of format configurations.
    SAFEARRAY* formatList = pvFormatsSupported.parray;
    WMDM_FORMATCODE formatCode = WMDM_FORMATCODE_NOTUSED;
    for(LONG iCap = 0; iCap < formatList->rgsabound[0].cElements; iCap++)
    { 
        // Get a format from the SAFEARRAY of retrieved formats.
        SafeArrayGetElement(formatList, &iCap, &formatCode);

        // Call a custom function to see the specifics of device support for 
       // each format.
        if (formatCode != WMDM_FORMATCODE_NOTUSED)
            myGetFormatCaps(formatCode, pDevice);
    }

e_Exit:
    // Clear out the memory we used.
    PropVariantClear(&pvFormatsSupported);
    return hr;
}

요구 사항

요구 사항
대상 플랫폼 Windows
헤더 mswmdm.h
라이브러리 Mssachlp.lib

추가 정보

디바이스 열거

IWMDMDevice3 인터페이스

IWMDMDevice3::SetProperty

IWMDMStorage3::GetMetadata

IWMDMStorage4::GetSpecifiedMetadata

파일에서 메타데이터 설정