I have an array of CSliderCtrl's in my windows form that I need to receive notifications from. I am using the ON_NOTIFY_RANGE declaration to map the slider updates to the appropriate handler. My problem is that the only event that gives me a notification is the NM_RELEASEDCAPTURE event. So my code looks like this:
BEGIN_MESSAGE_MAP(CTheThingDlg, CDialogEx)
ON_NOTIFY_RANGE(NM_RELEASEDCAPTURE, start_id, end_id, handler)
END_MESSAGE_MAP()
void MyClass::handler(UINT p_id, NMHDR* p_notify_msg_ptr, LRESULT* p_result_ptr)
{
//Do Stuff
}
I have tried using the WM_H/VSCROLL, TB_THUMBTRACK, TB_LINEUP/DOWN, and other events, but none give me the notification whether I use the mouse or keyboard to scroll. They are just simple horizontal scroll bars created with the following code:
slider_ctrl.Create(WS_CHILD | WS_VISIBLE | TBS_HORZ | TBS_BOTTOM | TBS_FIXEDLENGTH,
CRect(x1, y1, x2, y2),
this,
id);
A penny for your thoughts.
You need to handle the WM_HSCROLL message. TB_THUMBTRACK and the other TB notifications are not messages, they are passed to the WM_HSCROLL message handler in the nSBCode parameter.