PreTranslateMessage Problem???
-
I have a moduless dialog which has WS_CHILD property in a dll and used as an child in a view. when the dialog has focus ,it look the accelerator key massage as a dialog message and does not pass to it's parent(the view),while my purpose is that it should route the msg to the view and the dispatch to any it's child.Please tell me how to achieve this. some presetive code goes: In the view class:
BOOL CTestAccelView::PreTranslateMessage(MSG* pMsg) { if(TranslateAccelerator(m_hWnd,m_hAccelTest,pMsg)) return TRUE; if(m_pTestDlgWnd && m_pTestDlgWnd->GetSafeHwnd() ) if(m_pTestDlgWnd->PreTranslateMessage(pMsg)) return TRUE; if(m_pTestDlgWnd2 && m_pTestDlgWnd2->GetSafeHwnd()) if(m_pTestDlgWnd2->PreTranslateMessage(pMsg)) return TRUE; return CView::PreTranslateMessage(pMsg); }
In the Dialog class:BOOL CTestDlg::PreTranslateMessage(MSG* pMsg) { if(TranslateAccelerator(m_hWnd,m_hAccelTest,pMsg)) { return TRUE; } if(IsDialogMessage(pMsg)) { return TRUE; } return CWnd::PreTranslateMessage(pMsg); }
Scratch