Microsoft DirectX 9.0 |
Override the CBasePropertyPage::OnActivate method to initialize the dialog. In this example, the property page uses a slider control, so the first step in OnActivate is to initialize the common control library. The method then initializes the slider control using the current value of the filter's saturation property:
HRESULT CGrayProp::OnActivate(void)
{
INITCOMMONCONTROLSEX icc;
icc.dwSize = sizeof(INITCOMMONCONTROLSEX);
icc.dwICC = ICC_BAR_CLASSES;
if (InitCommonControlsEx(&icc) == FALSE)
{
return E_FAIL;
}
ASSERT(m_pGray != NULL);
HRESULT hr = m_pGray->GetSaturation(&m_lVal);
if (SUCCEEDED(hr))
{
SendDlgItemMessage(m_Dlg, IDC_SLIDER1, TBM_SETRANGE, 0,
MAKELONG(SATURATION_MIN, SATURATION_MAX));
SendDlgItemMessage(m_Dlg, IDC_SLIDER1, TBM_SETTICFREQ,
(SATURATION_MAX - SATURATION_MIN) / 10, 0);
SendDlgItemMessage(m_Dlg, IDC_SLIDER1, TBM_SETPOS, 1, m_lVal);
}
return hr;
}