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); }
SendMessage()主动发生消息,自己再接收消息。
在 PreTranslateMessage 中处理吧
不好意思再问一下: 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 ??????
我在OnLButtonDown中测试了一下,当有鼠标点击CListCtrl以外的时候,就向CListCtrl发NW_KILLFOCUS消息,没用。楼上的兄弟,你可以先测试一下,让后再回帖。
{
// TODO: Add your specialized code here and/or call the base class
if(WM_MOUSEWHEEL == pMsg->message)
{
AfxMessageBox(_T("AAA"));
}
return CDialog::PreTranslateMessage(pMsg);
}
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 ??????
OnMouseWheel是CListCtrl的消息?
那你在CDialog获取,当然获取不了。因为CDialog根本上就没这个消息。2、
调试if (pMsg->message == WM_MOUSEWHEEL)为真?
PreTranslateMessage 函数每次执行的只有
return CFormView::PreTranslateMessage(pMsg);