Share via


Modifying the Scale Property

[The feature associated with this page, Windows Media Player SDK, is a legacy feature. It has been superseded by MediaPlayer. MediaPlayer has been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use MediaPlayer instead of Windows Media Player SDK, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]

The default wizard implementation exposes the scale property. You can change the existing implementation to expose the delay time property instead.

First, use the following example to change the function prototypes for get_scale and put_scale in Echo.h. Change the name of the methods and the data types for the parameters:

// IEcho methods
STDMETHOD(get_delay)(DWORD *pVal);
STDMETHOD(put_delay)(DWORD newVal);

Next, change the implementations of the get_scale and put_scale methods in Echo.cpp. Make the code match the following examples:

// Formerly get_scale
STDMETHODIMP CEcho::get_delay(DWORD *pVal)
{
    if ( NULL == pVal )
    {
        return E_POINTER;
    }

    *pVal = m_dwDelayTime;

    return S_OK;
}

// Formerly put_scale
STDMETHODIMP CEcho::put_delay(DWORD newVal)
{
    m_dwDelayTime = newVal;

    return S_OK;
}

The preceding example code changes the method names and the parameter data types. The member variable name should have been changed previously. Remember to change the comments that introduce each method as well.

Now, change the interface definition. The following code replaces the code in the IEcho interface declaration in Echo.idl:

HRESULT get_delay([out] DWORD *pVal);
HRESULT put_delay([in] DWORD newVal);

Echo Sample Properties