# Function Reference

# _GUICtrlSlider_SetRange

Sets the range of minimum and maximum logical positions for the slider

#include <GuiSlider.au3>
_GUICtrlSlider_SetRange ( $hWnd, $iMinimum, $iMaximum )

## Parameters

$hWnd | Control ID/Handle to the control
$iMinimum | Minimum position for the slider
$iMaximum | Maximum position for the slider

## Return Value

None.

## Remarks

If the current slider position is outside the new range, the _GUICtrlSlider_SetRange() function sets the slider position to the new maximum or minimum value.

## Related

_GUICtrlSlider_GetRange, _GUICtrlSlider_SetRangeMax, _GUICtrlSlider_SetRangeMin

## Example

    #include <GUIConstantsEx.au3>
    #include <GuiSlider.au3>
    #include <MsgBoxConstants.au3>

    Example()

    Func Example()
        ; Create GUI
        GUICreate("Slider Get/Set Range (v" & @AutoItVersion & ")", 400, 296)
        Local $idSlider = GUICtrlCreateSlider(2, 2, 396, 20, BitOR($TBS_TOOLTIPS, $TBS_AUTOTICKS, $TBS_ENABLESELRANGE))
        GUISetState(@SW_SHOW)

        ; Get Range
        Local $aRange = _GUICtrlSlider_GetRange($idSlider)
        MsgBox($MB_SYSTEMMODAL, "Information", StringFormat("Range: %d - %d", $aRange[0], $aRange[1]))

        ; Set Range
        _GUICtrlSlider_SetRange($idSlider, 20, 50)

        ; Get Range
        $aRange = _GUICtrlSlider_GetRange($idSlider)
        MsgBox($MB_SYSTEMMODAL, "Information", StringFormat("Range: %d - %d", $aRange[0], $aRange[1]))

        ; Loop until the user exits.
        Do
        Until GUIGetMsg() = $GUI_EVENT_CLOSE
        GUIDelete()
    EndFunc   ;==>Example