我有一个CDialog,在上面只画了一个CListCtrl,默认焦点是在CListCtrl上,并且在上面插入了许多数据。
现在我想在CDialog中处理OnMouseWheel消息,一直处理响应不到,都被CListCtrl屏蔽掉了。应该如何处理????

解决方案 »

  1.   

    然后那?
    我在OnLButtonDown中测试了一下,当有鼠标点击CListCtrl以外的时候,就向CListCtrl发NW_KILLFOCUS消息,没用。楼上的兄弟,你可以先测试一下,让后再回帖。
      

  2.   

    PreTranslateMessage()这里可以截获传给子窗口(也就是控件窗口)的消息.
      

  3.   

    BOOL CXXDlg::PreTranslateMessage(MSG* pMsg) 
    {
    // TODO: Add your specialized code here and/or call the base class
    if(WM_MOUSEWHEEL == pMsg->message)
    {
    AfxMessageBox(_T("AAA"));
    }
    return CDialog::PreTranslateMessage(pMsg);
    }
      

  4.   

    SendMessage()主动发生消息,自己再接收消息。
      

  5.   

    在 PreTranslateMessage 中处理吧
      

  6.   

    不好意思再问一下:
    BOOL CTestSDI01View::PreTranslateMessage(MSG* pMsg)
    {
    if (pMsg->message == WM_MOUSEWHEEL)
    {
    if ((m_ctlListErrorInfo.m_hWnd == pMsg->hwnd) && m_bClickListItem)
    {
    return CFormView::PreTranslateMessage(pMsg);
    }
    else if (pMsg->hwnd == this->m_hWnd)
    {
    PostMessage(WM_MOUSEWHEEL, 0, 0);
    }
    }
    return CFormView::PreTranslateMessage(pMsg);
    }
    为啥一直不进else if ??????
      

  7.   

    1、 
    OnMouseWheel是CListCtrl的消息?
    那你在CDialog获取,当然获取不了。因为CDialog根本上就没这个消息。2、
    调试if (pMsg->message == WM_MOUSEWHEEL)为真?
    PreTranslateMessage  函数每次执行的只有
    return CFormView::PreTranslateMessage(pMsg);