void CSliceDlgBar::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) { // TODO: Add your message handler code here and/or call default CXSliceFrame* pParentFrm = (CXSliceFrame*)GetParentFrame(); CView* pAcView = pParentFrm->GetActiveView(); INT nBright = m_wndSldBright.GetPos(); INT nContrast = m_wndSldContrast.GetPos(); pAcView->PostMessage(WM_ADJUST_IMAGE,nBright,nContrast); }
DWORD CEtsEodManagerDoc::_ReadLine(const CString& strBuf, const long nOffset, long* pnRead, bool bNotify) { int iEnd = nOffset; CString strRecord; iEnd = strBuf.Find(_T("\r\n"), iEnd); if(iEnd < 0) return ERROR_INSUFFICIENT_BUFFER; strRecord = strBuf.Mid(nOffset, iEnd - nOffset); CEodReportRec aRec; long nStep = 0L; if(aRec.ReadFromString(strRecord, nStep)) { CEodReportStep& aStep = m_mapSteps[nStep]; { CAutoLock lock(m_csLock); aStep.AddRecord(aRec); } if(bNotify) { size_t nRecIdx = aStep.GetRecs().size() - 1; POSITION pos = GetFirstViewPosition(); CView* pView = GetNextView(pos); if(pView) { if(aRec.m_nType != enRpMtProgress) pView->PostMessage(WM_EOD_NEW_RECORD, (WPARAM)nStep, (LPARAM)nRecIdx); else pView->PostMessage(WM_EOD_STEP_PROGRESS, (LPARAM)nStep, 0L); } } } *pnRead = strRecord.GetLength(); return ERROR_SUCCESS; }
void CTagVwSplit::OnSetFocus(CWnd* pOldWnd) { if (gs_pCmd->BusyDocument()) { POSITION pos = gs_pCmd->BusyDocument()->GetFirstViewPosition(); ASSERT(pos); CView* pView = gs_pCmd->BusyDocument()->GetNextView(pos); if (GetActiveView()!=pView) pView->PostMessage(WMU_DOSETFOCUS, 0 , (LPARAM)pView); } else CMDIChildWnd::OnSetFocus(pOldWnd); }
void DocRoot::UpdateAllViewsByMsg(CView* pSender, LPARAM lHint, CObject* pHint, BOOL PostMsg/*=FALSE*/) {// walk through all views ASSERT(pSender == NULL || !m_viewList.IsEmpty()); // must have views if sent by one of them POSITION pos = GetFirstViewPosition(); while (pos != NULL) { CView* pView = GetNextView(pos); if (pView != pSender) { if (PostMsg) pView->PostMessage(WMU_ONUPDATE, lHint, (LPARAM)pHint); else pView->SendMessage(WMU_ONUPDATE, lHint, (LPARAM)pHint); } } }
BOOL CChildFrame::PreTranslateMessage(MSG* pMsg) { // TODO: Add your specialized code here and/or call the base class CMainFrame * pMainFrame = AfxGetMainFrame( ); if( WM_SYSKEYDOWN == pMsg->message || WM_SYSKEYUP == pMsg->message || WM_SYSCHAR == pMsg->message ) { if( pMainFrame && VK_F4 == pMsg->wParam ) { pMainFrame->PostMessage( WM_CLOSE ); return TRUE; } } else if( WM_RBUTTONUP == pMsg->message || WM_RBUTTONDOWN == pMsg->message || WM_NCRBUTTONUP == pMsg->message || WM_NCRBUTTONDOWN == pMsg->message ) { CWnd* pWnd = CWnd::FromHandlePermanent(pMsg->hwnd); CView * pView = DYNAMIC_DOWNCAST( CView, pWnd ); if( NULL == pView ) pView = GetActiveView(); UINT nMenuID = 0; if( pView && pView->IsKindOf(RUNTIME_CLASS(CWizardView)) ) nMenuID = IDR_POPUP_WIZARDVIEW; else if( pView && pView->IsKindOf(RUNTIME_CLASS(CSimuView)) ) nMenuID = IDR_POPUP_SIMUVIEW; else if( pView && pView->IsKindOf(RUNTIME_CLASS(CSListView)) ) nMenuID = IDR_POPUP_SLISTVIEW; else if( pView && pView->IsKindOf(RUNTIME_CLASS(CGraphView)) ) { pView->PostMessage(WM_USER_MYRBUTTONDOWN,pMsg->wParam,pMsg->lParam); nMenuID = IDR_POPUP_GRAPHVIEW; } else if( pView && pView->IsKindOf(RUNTIME_CLASS(CRealTimeView)) ) nMenuID = IDR_POPUP_REALTIMEVIEW; else if( pView && pView->IsKindOf(RUNTIME_CLASS(CMultiSortView)) ) nMenuID = IDR_POPUP_MULTISORTVIEW; else if( pView && pView->IsKindOf(RUNTIME_CLASS(CBaseView)) ) nMenuID = IDR_POPUP_BASEVIEW; else if( pView && pView->IsKindOf(RUNTIME_CLASS(CSelectorView)) ) nMenuID = IDR_POPUP_SETTING; else if( pView && pView->IsKindOf(RUNTIME_CLASS(CStrategyView)) ) nMenuID = IDR_POPUP_SIMUVIEW; else if( pView && pView->IsKindOf(RUNTIME_CLASS(CGroupView)) ) nMenuID = IDR_POPUP_SETTING; else if( pView && pView->IsKindOf(RUNTIME_CLASS(CTechsView)) ) nMenuID = IDR_POPUP_SETTING; if( pMainFrame && 0 != nMenuID ) { if( pWnd && WM_RBUTTONUP == pMsg->message ) { CPoint pt; pt.x = LOWORD(pMsg->lParam); pt.y = HIWORD(pMsg->lParam); pWnd->ClientToScreen(&pt); CMenu menu; if( menu.LoadMenu( nMenuID ) ) { CMenu * pMenu = menu.GetSubMenu(0); for( UINT nMenu=0; pMenu && nMenu<pMenu->GetMenuItemCount(); nMenu++ ) { CMenu * pPopupMenu = pMenu->GetSubMenu(nMenu); pMainFrame->InitMenuPopup( pPopupMenu ); } /* ProfUIS Using Code CExtPopupMenuWnd * pPopupWnd = new CExtPopupMenuWnd; VERIFY( pPopupWnd->UpdateFromMenu( pMainFrame->GetSafeHwnd(), &menu, true, true ) ); VERIFY( pPopupWnd->TrackPopupMenu( TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, pMainFrame->GetSafeHwnd() ) ); */ VERIFY( pMenu->TrackPopupMenu( TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, pMainFrame ) ); } } return TRUE; } } /* ProfUIS Using Code if( pMainFrame && pMainFrame->m_wndMenuBar.TranslateMainFrameMessage(pMsg) ) return TRUE; */ return CMDIChildWnd::PreTranslateMessage(pMsg); }