对话框是如何转发消息给子控件的?我希望过滤某些键盘消息。

解决方案 »

  1.   

    BOOL CTestV1View::PreTranslateMessage(MSG* pMsg) 
    {
    // TODO: Add your specialized code here and/or call the base class
    if(pMsg->hwnd=XXX&&pMsg->wParam)
    {
    return TRUE;
    }
    return CFormView::PreTranslateMessage(pMsg);
    }
      

  2.   

    BOOL CTestV1View::PreTranslateMessage(MSG* pMsg) 
    {
    // TODO: Add your specialized code here and/or call the base class
    if(pMsg->hwnd=XXX&&pMsg->message==WM_XXX)
    {
    return TRUE;
    }
    return CFormView::PreTranslateMessage(pMsg);
    }