CBasePropertyPage.OnActivate 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 OnActivate method is called when the property page is activated.

Syntax

virtual HRESULT OnActivate();

Parameters

This method has no parameters.

Return value

The base-class implementation returns S_OK.

Remarks

The CBasePropertyPage::Activate method calls the OnActivate method. In your derived class, override OnActivate to initialize the dialog box.

Examples

The following example initializes a trackbar control. This example assumes that m_pOwningFilter is a pointer to a custom interface on the filter associated with the property page. (Use the CBasePropertyPage::OnConnect method to initialize such pointers.)

HRESULT CMyProp::OnActivate(void)
{
    ASSERT(m_pOwningFilter != NULL);
    m_pOwningFilter->GetSomeProperty(&m_lOldVal);
    
    SendDlgItemMessage(m_Dlg, IDC_SLIDER1, TBM_SETRANGE, 0, MAKELONG(0, 100));
    SendDlgItemMessage(m_Dlg, IDC_SLIDER1, TBM_SETTICFREQ, 10, 0);
    SendDlgItemMessage(m_Dlg, IDC_SLIDER1, TBM_SETPOS, 1, m_lOldVal);
    return S_OK;
}

Requirements

Requirement Value
Header
Cprop.h (include Streams.h)
Library
Strmbase.lib (retail builds);
Strmbasd.lib (debug builds)

See also

CBasePropertyPage Class