I have a custom CTabCtrl which I am trying to customize (to automatically change pages).
If I handle ON_NOTIFY_REFLECT(TCN_SELCHANGE, ...)
in my tab control, ON_NOTIFY(TCN_SELCHANGE, ...)
is not received by the parent class.
How can I receive both notify messages in the child and parent classes?
Currently I am using a "workaround" of manually sending the WM_NOTIFY message to the parent class:
void CMyTabControl::OnSelChange(NMHDR *pHeader, LRESULT *pResult)
{
const int index = this->GetCurSel();
this->ShowTab(index);
const CWnd *const pParent = this->GetParent();
if (pParent != NULL)
{
*pResult = pParent->SendMessage(WM_NOTIFY, TCN_SELCHANGE,
reinterpret_cast<LPARAM>(pHeader));
}
}
Edit: I've tried both *pResult = 0 and *pResult = 1 but it still doesn't send the message onto the parent. Also, I've noticed that when I send the message on to the parent I end up in an almost infinite loop (for some reason it does break out after several iterations).