当一个对话框中有控件时,为什么对话框接收不到KEY_DOWN消息,但将所有的控件删除后就可以接收到,原本以为是焦点在控件上,但用SetFocus()将焦点设置到对话框中也不行。请问是什么原因呢?

解决方案 »

  1.   

    当对话框调用SetFocus,他会自动将焦点转到控件上的
      

  2.   

    BOOL CDlgNleClipEdit::PreTranslateMessage(MSG* pMsg) 
    {
      if (pMsg->message == WM_KEYDOWN)
      {
        ......
      }
      return CDlg::PreTranslateMessage(pMsg);
    }
      

  3.   

    BOOL CDlgTemp::PreTranslateMessage(MSG* pMsg) 
    {
      if (pMsg->message == WM_KEYDOWN)
      {
        ......
      }
      return CDialog::PreTranslateMessage(pMsg);
    }
      

  4.   

    virtual BOOL PreTranslateMessage(MSG* pMsg);