I am using a MFC dialog based application and have a subclassed CStatic
control. I would like to receive WM_MOUSEWHEEL and other messages inside my subclassed control but somehow those messages never arrive.
Here is how my Dialog looks like:
I'm only doing some really simple drawing and want to be able to move my list up and down by scrolling.
I did already:
- Change the Tab-Order to ensure focus on the subclassed CStatic control first
- Overwrote OnNcHitTest to give focus to the subclassed CStatic all the time
- Added a scroll bar to the side
- Wrote message handler for WM_MOUSEWHEEL, WM_LBUTTONDOWN, WM_KEYDOWN and WM_VSCROLL
- Tried catching the messages in
PreTranslateMessage
Sadly nothing ever gets called when I'm scrolling inside the Dialog / Pressing a key or clicking with my mouse. The messages just don't arrive.
Here is my Mousewheel handler for example:
class CFolderView : public CStatic
{
...
afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt);
DECLARE_MESSAGE_MAP()
...
}
BEGIN_MESSAGE_MAP(CFolderView, CStatic)
ON_WM_MOUSEWHEEL()
ON_WM_KEYDOWN()
ON_WM_LBUTTONDOWN()
END_MESSAGE_MAP()
BOOL CFolderView::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt)
{
MessageBox("Mouse Wheel moved!", "Debug", MB_OK);
return CStatic::OnMouseWheel(nFlags, zDelta, pt);
}
I fail to understand why no input messages are being sent to my subclassed control. Is there some switch that enables input for a subclassed control?