STDMETHODIMP CBasePropertyPage::Apply() { // In ActiveMovie 1.0 we used to check whether we had been activated or // not. This is too constrictive. Apply should be allowed as long as // SetObject was called to set an object. So we will no longer check to // see if we have been activated (ie., m_hWnd != NULL), but instead // make sure that m_bObjectSet is TRUE (ie., SetObject has been called). if (m_bObjectSet == FALSE) { return E_UNEXPECTED; } // Must have had a site set if (m_pPageSite == NULL) { return E_UNEXPECTED; } // Has anything changed if (m_bDirty == FALSE) { return NOERROR; } // Commit derived class changes HRESULT hr = OnApplyChanges(); if (SUCCEEDED(hr)) { m_bDirty = FALSE; } return hr; }
// // OnReceiveMessage // // Handles the messages for our property window // BOOL CHandVuFilterProperties::OnReceiveMessage(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { if (!m_bIsInitialized) { return (LRESULT) 1; } switch (uMsg) { case WM_HSCROLL: { if (m_params.immediate_apply) { OnApplyChanges(); } else { m_bDirty = TRUE; if (m_pPageSite) { m_pPageSite->OnStatusChange(PROPPAGESTATUS_DIRTY); } } return (LRESULT) 1; break; } case WM_COMMAND: { if (m_params.immediate_apply) { OnApplyChanges(); } else { m_bDirty = TRUE; if (m_pPageSite) { m_pPageSite->OnStatusChange(PROPPAGESTATUS_DIRTY); } } return (LRESULT) 1; break; } } return (BOOL) CBasePropertyPage::OnReceiveMessage(hwnd,uMsg,wParam,lParam); } // OnReceiveMessage
// // OnDisconnect // // Called when we're disconnected from a filter // HRESULT CCamShiftProperties::OnDisconnect() { // Release of Interface after setting the appropriate contrast value if (m_pCamShift == NULL) { return E_UNEXPECTED; } OnApplyChanges(); m_pCamShift->Release(); m_pCamShift = NULL; return NOERROR; } // OnDisconnect
// // OnReceiveMessage // // Virtual method called by base class with Window messages // BOOL CCamShiftProperties::OnReceiveMessage( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch (uMsg) { case WM_INITDIALOG: m_hWnd = hwnd; InitSlider( IDC_WIN_LEFT, 0, 1000, 0 ); InitSlider( IDC_WIN_TOP, 0, 1000, 0 ); InitSlider( IDC_WIN_WIDTH, 0, 1000, 0 ); InitSlider( IDC_WIN_HEIGHT, 0, 1000, 0 ); InitSlider( IDC_S_MIN, 0, 255, 5 ); InitSlider( IDC_V_MIN, 0, 255, 5 ); //InitSlider( IDC_SAMPLES_NUM, 16, 256, 16 ); WriteParamsToControls(); break; case WM_HSCROLL: OnApplyChanges(); break; case WM_COMMAND: OnApplyChanges(); if(LOWORD(wParam) == IDC_START) { m_pCamShift->StartTracking(); } else if (LOWORD(wParam) == IDC_STOP) { m_pCamShift->StopTracking(); } break; } return CBasePropertyPage::OnReceiveMessage(hwnd,uMsg,wParam,lParam); } // OnReceiveMessage
STDMETHODIMP TffdshowPageBase::Apply(void) { if (wasobjectset == FALSE) { return E_UNEXPECTED; } if (pageSite == NULL) { return E_UNEXPECTED; } if (!dirty) { return NOERROR; } HRESULT hr = OnApplyChanges(); if (SUCCEEDED(hr)) { dirty = false; } return hr; }
INT_PTR CDVSBasePPage::OnReceiveMessage(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch(uMsg) { case WM_COMMAND: { if(m_bIsInitialized) { m_bDirty = TRUE; if(m_pPageSite) m_pPageSite->OnStatusChange(PROPPAGESTATUS_DIRTY); switch(HIWORD(wParam)) { case BN_CLICKED: case CBN_SELCHANGE: case EN_CHANGE: { AFX_MANAGE_STATE(AfxGetStaticModuleState()); if(!m_fDisableInstantUpdate && !(HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDC_INSTANTUPDATE) && !!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_INSTANTUPDATE), 1)) OnApplyChanges(); } } } } break; case WM_NCDESTROY: DetachControls(); break; } return OnMessage(uMsg, wParam, lParam) ? 0 : CBasePropertyPage::OnReceiveMessage(hwnd,uMsg,wParam,lParam); }
bool CDVSMainPPage::OnMessage(UINT uMsg, WPARAM wParam, LPARAM lParam) { switch (uMsg) { case WM_COMMAND: { switch (HIWORD(wParam)) { case BN_CLICKED: { if (LOWORD(wParam) == IDC_OPEN) { AFX_MANAGE_STATE(AfxGetStaticModuleState()); CFileDialog fd(TRUE, NULL, NULL, OFN_EXPLORER|OFN_ENABLESIZING|OFN_HIDEREADONLY|OFN_FILEMUSTEXIST|OFN_PATHMUSTEXIST, _T(".idx .smi .sub .srt .psb .ssa .ass .usf .sup|*.idx;*.smi;*.sub;*.srt;*.psb;*.ssa;*.ass;*.usf;*.sup|") _T("All files (*.*)|*.*||"), CDialog::FromHandle(m_Dlg), 0); if (fd.DoModal() == IDOK) { m_fnedit.SetWindowText(fd.GetPathName()); } return true; } else if (LOWORD(wParam) == IDC_FONT) { AFX_MANAGE_STATE(AfxGetStaticModuleState()); CStyleEditorDialog dlg(_T("Default"), &m_defStyle, CWnd::FromHandle(m_hwnd)); if (dlg.DoModal() == IDOK) { BOOL bStyleChanged = FALSE; if (dlg.m_stss != m_defStyle) { bStyleChanged = TRUE; } m_defStyle = dlg.m_stss; CString str = m_defStyle.fontName; if (str.GetLength() > 18) { str = str.Left(16).TrimRight() + _T("..."); } m_font.SetWindowText(str); if (bStyleChanged) { m_bDirty = TRUE; if (m_pPageSite) { m_pPageSite->OnStatusChange(PROPPAGESTATUS_DIRTY); } if (!m_fDisableInstantUpdate && !!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_INSTANTUPDATE), 1)) { OnApplyChanges(); } } } return true; } } break; } } break; } return false; }