Step 9. Disconnect the Property Page
[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.]
Override the CBasePropertyPage::OnDisconnect method to release any interfaces that you obtained in the OnConnect method. Also, if the user dismisses the property sheet without committing the changes, you should restore the original values if they have changed. There is no "OnCancel" method that gets called when the user cancels, so you need to keep track of whether the user has called OnApplyChanges. This example uses the m_lVal variable, described earlier:
HRESULT CGrayProp::OnDisconnect(void)
{
if (m_pGray)
{
// If the user clicked OK, m_lVal holds the new value.
// Otherwise, if the user clicked Cancel, m_lVal is the old value.
m_pGray->SetSaturation(m_lVal);
m_pGray->Release();
m_pGray = NULL;
}
return S_OK;
}
Next: Step 10. Support COM Registration
Related topics