IKsPropertySet::Get method

[The feature associated with this page, DirectShow, is a legacy feature. It has been superseded by MediaPlayer, IMFMediaEngine, and Audio/Video Capture in Media Foundation. Those features have been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use MediaPlayer, IMFMediaEngine and Audio/Video Capture in Media Foundation instead of DirectShow, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]

The Get method retrieves a property identified by a property set GUID and a property ID.

Syntax

HRESULT Get(
  [in]  REFGUID guidPropSet,
  [in]  DWORD   dwPropID,
  [in]  LPVOID  pInstanceData,
  [in]  DWORD   cbInstanceData,
  [out] LPVOID  pPropData,
  [in]  DWORD   cbPropData,
  [out] DWORD   *pcbReturned
);

Parameters

guidPropSet [in]

The GUID of the property set .

dwPropID [in]

The identifier of the property within the property set.

pInstanceData [in]

A pointer to an array of bytes that contains instance data for the property.

cbInstanceData [in]

The size of the array given in pInstanceData, in bytes.

pPropData [out]

A pointer to an array of bytes that receives the property data.

cbPropData [in]

The size of the array given in pPropData, in bytes.

pcbReturned [out]

Receives the number of bytes the method copies to the pPropData array.

Return value

Returns an HRESULT value. Possible values include the following.

Return code Description
S_OK
Success.
E_PROP_SET_UNSUPPORTED
The property set is not supported.
E_PROP_ID_UNSUPPORTED
The property ID is not supported for the specified property set.

 

Remarks

Note

Another interface by this name exists in the dsound.h header file. The two interfaces are not compatible. The IKsControl interface, documented in the DirectShow DDK, is now the recommended interface for passing property sets between WDM drivers and user mode components.

 

To retrieve a property, allocate a buffer which this method will then fill in. To determine the necessary buffer size, specify NULL for pPropData and zero (0) for cbPropData. This method returns the necessary buffer size in pcbReturned.

You must include Ks.h before Ksproxy.h.

Examples

The following example queries a pin for its pin category, by retrieving the AMPROPERTY_PIN_CATEGORY property. (See Pin Property Set.)

HRESULT GetPinCategory(IPin *pPin, GUID *pPinCategory)
{
    IKsPropertySet *pKs = NULL;

    HRESULT hr = pPin->QueryInterface(IID_PPV_ARGS(&pKs));
    if (FAILED(hr))
    {
        return hr;
    }

    // Try to retrieve the pin category.
    DWORD cbReturned = 0;
    hr = pKs->Get(AMPROPSETID_Pin, AMPROPERTY_PIN_CATEGORY, NULL, 0, 
        pPinCategory, sizeof(GUID), &cbReturned);
    
    // If this succeeded, pPinCategory now contains the category GUID.

    SafeRelease(&pKs);
    return hr;
}

Requirements

Requirement Value
Minimum supported client
Windows 2000 Professional [desktop apps only]
Minimum supported server
Windows 2000 Server [desktop apps only]
Header
Ksproxy.h
Library
Strmiids.lib

See also

Error and Success Codes

IKsPropertySet Interface

Property Sets