c语言,slider控件还不会用。如何获取当前滑块的值?请列举一段代码,谢谢!

2025-05-23 13:53:22
推荐回答(3个)
回答1:

查查msdn 发现slider control其实就是 trackbar control

msdn 中unser interface services 的 windows common control 下的trackbar control 就是其帮助

vc6 用c写的例子......获取当前滑块的值原理 给 slider控件发送TBM_GETPOS消息


回答2:

dwPos = SendMessage(hwndCtrl,TBM_GETPOS,0,0);这个就能获取Slider的值,就是dwPos,hwndCtrl就是Slider控件的句柄

回答3:

HWND hwndSlideVolume = GetDlgItem(hwnd, IDC_SLIDERMUSICVOLUME);//获得句柄 int intVolumn = 0; intVolumn = SendMessage(hwndSlideVolume, TBM_GETPOS , 0, 0); //得到音量值