Article ID: 150574
Article Last Modified on 11/21/2006
APPLIES TO
- Microsoft Foundation Class Library 4.2, when used with:
- Microsoft Visual C++ 1.5 Professional Edition
- Microsoft Visual C++ 1.51
- Microsoft Visual C++ 1.52 Professional Edition
- Microsoft Visual C++ 2.0 Professional Edition
This article was previously published under Q150574
SYMPTOMS
Scroll messages generated by scroll related controls in a CScrollView-
derived object fail to invoke the control's OnChildNotify function.
CAUSE
CScrollView::OnVScroll and CScrollView::OnHScroll do not call
SendChildNotifyLastMsg, which is responsible for calling OnChildNotify.
RESOLUTION
Override OnVScroll and/or OnHScroll for your CScrollView-derived class, and
implement this code:
void CMyView::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar*
pScrollBar)
{
if (pScrollBar != NULL && pScrollBar->SendChildNotifyLastMsg())
return; // eat it
// ignore scroll bar msgs from other controls
if (pScrollBar != GetScrollBarCtrl(SB_VERT))
return;
OnScroll(MAKEWORD(-1, nSBCode), nPos);
}
void CMyView::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar*
pScrollBar)
{
// same as above
...
}
STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed
at the beginning of this article. This problem is corrected in Microsoft
Visual C++ version 4.0.
REFERENCES
For additional information, please see the following article in the
Microsoft Knowledge Base:
133034 BUG: CSpinButtonCtrl Causes Assertion in viewscrl.cpp line 698.
MFC Technical Note #21 - Command and Message Routine
Books Online - CWnd::OnChildNotify
Additional query words: 1.50 1.51 1.52 2.00 2.10 2.20
Keywords: kbbug kbdocview kbfix kbnoupdate kbvc400fix KB150574