例如用ON_NOTIFY和NM_RELEASEDCAPTURE可以实现当鼠标在CSliderCtrl上释放时向外触发消息
但是这样必须释放鼠标才有效果,因此不连续能否实现不用鼠标释放,当CSliderCtrl的Pos变化即向外触发消息
应该怎么处理呢?

解决方案 »

  1.   

    父窗口响应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.
      

  2.   

    没太明白啊
    请细细指教我的意思是
    用ON_NOTIFY(NM_RELEASEDCAPTURE, IDC_SLIDER, OnReleasedcaptureSlider)可以将IDC_SLIDER与OnReleasedcaptureSlider函数关联,当鼠标在IDC_SLIDER上释放时执行OnReleasedcaptureSlider能否实现“当IDC_SLIDER的位置变化时就执行OnReleasedcaptureSlider函数”,这样可以得到连续的Pos值