本帖最后由 风行者 于 2011-6-4 09:33 编辑
刚好用到,搜索论坛居然没搜到相关例子,后来查msdn解决
方便以后查看,需要的就拿去吧,代码如下:
Global Const $WM_HSCROLL = 0x0114
$Form1 = GUICreate("滑动条实时显示", 314, 120, 192, 124)
$Label1 = GUICtrlCreateLabel("当前数值:50", 16, 24, 131, 28)
GUICtrlSetFont(-1, 16, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFF0000)
$Slider1 = GUICtrlCreateSlider(8, 72, 297, 33)
GUICtrlSetLimit(-1,100,0)
GUICtrlSetData(-1,50)
GUIRegisterMsg($WM_HSCROLL, "WM_HSCROLL")
GUISetState()
Do
Until GUIGetMsg()=-3
Func WM_HSCROLL($Hwnd, $iMsg, $Wparam, $iLparam)
$nNotifyCode = BitShift($Wparam, 16) ;高位为控件标识
$nID = BitAND($Wparam, 0x000FFFF) ;低位为数值
Switch $nID
Case $Slider1
GUICtrlSetData($Label1, "当前数值:" &$nNotifyCode)
EndSwitch
EndFunc ;==>WM_HSCROLL
|