I have a dialog with a rich-text control. The dialog wants to intercept right-click events on the control; in some cases the dialog should do its own functionality and block the message reaching the control, in other cases it should let the control receive the message.
So I have:
ON_NOTIFY(EN_MSGFILTER, IDC_RICHTEXT, OnRichTextMsgfilter)
void CMyDialog::OnRichTextMsgfilter(NMHDR *pNMHDR, LRESULT *pResult)
{
MSGFILTER *pMsgFilter = reinterpret_cast<MSGFILTER *>(pNMHDR);
*pResult = 0;
if (pMsgFilter->msg == WM_RBUTTONUP)
{
if(...)
*pResult=1;
}
}
I step through the code and pResult
is set when it should be, but the control still gets the message. Looking at MSDN it says:
If the control should process the event, the message returns a zero value. If the control should ignore the event, the message returns a nonzero value.
But the defined message handler signature has no return... I am assuming that's what *pResult is for. Is that not true? If so how do I achieve this?