怎么实现CSliderCtrl的位置变化时向外触发消息
例如用ON_NOTIFY和NM_RELEASEDCAPTURE可以实现当鼠标在CSliderCtrl上释放时向外触发消息
但是这样必须释放鼠标才有效果,因此不连续
能否实现不用鼠标释放,当CSliderCtrl的Pos变化即向外触发消息
应该怎么处理呢?
[解决办法]
父窗口响应WM_HSCROLL或WM_VSCROLL 视滑块方向而定,如果messages包含的窗口句柄是CSliderCtrl,证明滑块在移动。
///////////////////////////////////////////////////////////////////////////////
A slider control notifies its parent window of user actions by sending the parent WM_HSCROLL or WM_VSCROLL messages, depending on the orientation of the slider control. To handle these messages, add handlers for the WM_HSCROLL and WM_VSCROLL messages to the parent window. The OnHScroll and OnVScroll member functions will be passed a notification code, the position of the slider, and a pointer to the CSliderCtrl object. Note that the pointer is of type CScrollBar * even though it points to a CSliderCtrl object. You may need to typecast this pointer if you need to manipulate the slider control.