Поделиться через


Adding Properties to the Sample Rendering Plug-in (deprecated)

This page documents a feature that may be unavailable in future versions of Windows Media Player and the Windows Media Player SDK.

The rendering sample code that the Windows Media Player Plug-in Wizard generates uses a single property that represents the color of the text rendered. Your plug-in may require more than one property. You can easily add properties to your rendering plug-in in Microsoft Visual Studio using the following steps:

  1. Define the methods in the interface definition code in the project's main header file. For example, to add a property called "scale", you would create two accessor methods using the following syntax:

    
    virtual HRESULT STDMETHODCALLTYPE get_scale(double *pVal) = 0;
    virtual HRESULT STDMETHODCALLTYPE put_scale(double newVal) = 0;
    
  2. Add the method declarations to the main class declaration in the header file:

    
    STDMETHOD(get_scale)(double *pVal);
    STDMETHOD(put_scale)(double newVal);
    
  3. Add the method implementations to the project's main CPP file:

    
    STDMETHODIMP CYourProject::get_scale(double *pVal)
    {
        if ( NULL == pVal )
        {
            return E_POINTER;
        }
    
        *pVal = m_fScale;
    
        return S_OK;
    }
    
    STDMETHODIMP CYourProject::put_scale(double newVal)
    {
        m_fScale = newVal;
    
        return S_OK;
    }
    

Finally, to make the properties accessible to the user, you'll want to make changes to the property page implementation.

Implementing Your Rendering Code (deprecated)