有一个窗口有一个控件,Slider,也就是滑块控件
现在我准备写一个程序,向它发送消息,让slider控件的滑块移动,向左或向右移,如何办?发送什么消息

解决方案 »

  1.   

    给slider控件关联一个int变量。
    然后向窗口发消息,在消息处理函数里改变变量的值
      

  2.   

    Sets the current logical position of the slider in a trackbar. Syntax
    To send this message, call the SendMessage function as follows. 
    lResult = SendMessage(      // returns LRESULT in lResult     (HWND) hWndControl,      // handle to destination control     (UINT) TBM_SETPOS,      // message ID     (WPARAM) wParam,      // = (WPARAM) (BOOL) fPosition;    (LPARAM) lParam      // = (LPARAM) (LONG) lPosition; );  
      

  3.   

    int lResult   =   ::SendMessage( (HWND)   hwnd2,  (UINT)   TBM_SETPOS, (WPARAM)   TRUE, (LPARAM)   (LONG)   50 );         
    谢了!两位,给分
      

  4.   

    对了,如何获取这个SLIDER滑块,当前的所在位置?