0

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.

Ian
  • 4,169
  • 3
  • 37
  • 62

1 Answers1

1

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.

ScottMcP-MVP
  • 10,337
  • 2
  • 15
  • 15
  • Okay, so I've tried putting WM_HSCROLL into the ON_NOTIFY_CHANGE declaration like so: ON_NOTIFY_RANGE(WM_HSCROLL, ...) and it doesn't work. If I just change WM_HSCROLL to NM_RELEASEDCAPTURE I get the event. Isn't this supposed to work. I'm on Windows 7. – Ian Jul 22 '14 at 21:49