07-09-2006, 08:40 AM
Function SetTrackbarPos
Function GetTrackbarInfo
;/
function hwndTB value [flags] ;;flags: 1 don't notify parent
;Sets trackbar control thumb position.
;value should be between min and max values of the trackbar control (use GetTrackBarInfo to get)
;EXAMPLE
;int hwndTB=id(1001 win("" "Volume Control"))
;int rmin rmax
;GetTrackbarInfo hwndTB rmin rmax ;;get range
;SetTrackbarPos hwndTB rmin+rmax/2 ;;set middle value
;bee
;1
;SetTrackbarPos hwndTB rmin ;;set min value (max sound)
;bee
def TBM_SETPOS (WM_USER+5)
def TBS_VERT 0x0002
def TB_THUMBPOSITION 4
def TB_THUMBTRACK 5
def TB_THUMBPOSITION 4
def TB_ENDTRACK 8
SendMessage hwndTB TBM_SETPOS 1 value
if(flags&1=0)
,int hwnd=GetParent(hwndTB)
,int msg=iif(GetWinStyle(hwndTB)&TBS_VERT WM_VSCROLL WM_HSCROLL)
,value<<16
,SendMessage hwnd msg TB_THUMBTRACK|value hwndTB
,SendMessage hwnd msg TB_THUMBPOSITION|value hwndTB
,SendMessage hwnd msg TB_ENDTRACK hwndTBFunction GetTrackbarInfo
;/
function# hwndTB [&rangeMin] [&rangeMax]
;Returns trackbar control thumb position and optionally more info.
def TBM_GETPOS (WM_USER)
def TBM_GETRANGEMIN (WM_USER+1)
def TBM_GETRANGEMAX (WM_USER+2)
if(&rangeMin) rangeMin=SendMessage(hwndTB TBM_GETRANGEMIN 0 0)
if(&rangeMax) rangeMax=SendMessage(hwndTB TBM_GETRANGEMAX 0 0)
ret SendMessage(hwndTB TBM_GETPOS 0 0)