# Function Reference

# _GUICtrlSlider_Create

Create a Slider control

#include <GuiSlider.au3>
_GUICtrlSlider_Create ( $hWnd, $iX, $iY [, $iWidth = 100 [, $iHeight = 20 [, $iStyle = $TBS_AUTOTICKS [, $iExStyle = 0x00000000]]]] )

## Parameters

$hWnd | Handle to parent or owner window
$iX | Horizontal position of the control
$iY | Vertical position of the control
$iWidth | [optional] Control width
$iHeight | [optional] Control height
$iStyle | [optional] Control style: $TBS_AUTOTICKS - Adds tick marks when you set the range on the slider by using the TBM_SETRANGE message $TBS_BOTH - Places ticks on both sides of the slider $TBS_BOTTOM - Places ticks on the bottom of a horizontal slider $TBS_DOWNISLEFT - Down equal left and up equal right $TBS_ENABLESELRANGE - The tick marks at the starting and ending positions of a selection range are displayed as triangles (instead of vertical dashes), and the selection range is highlighted. $TBS_FIXEDLENGTH - allows the size of the slider to be changed with the $TBM_SETTHUMBLENGTH message $TBS_HORZ - Specifies a horizontal slider. This is the default $TBS_LEFT - Places ticks on the left side of a vertical slider $TBS_NOTHUMB - Specifies that the slider has no slider $TBS_NOTICKS - Specifies that no ticks are placed on the slider $TBS_REVERSED - Smaller number indicates "higher" and a larger number indicates "lower" $TBS_RIGHT - Places ticks on the right side of a vertical slider $TBS_TOP - Places ticks on the top of a horizontal slider $TBS_TOOLTIPS - Creates a default ToolTip control that displays the slider's current position $TBS_VERT - Creates a vertical slider Default: $TBS_AUTOTICKS Forced : $WS_CHILD, $WS_VISIBLE
$iExStyle | [optional] Control extended style. These correspond to the standard $WS_EX_* constants. See Extended Style Table. Default: $WS_EX_STATICEDGE

## Return Value

Success: | the handle to the slider control.
Failure: | 0

## Remarks

This function is for Advanced users and for learning how the control works.

## Related

_GUICtrlSlider_Destroy

## Example

### Example : Created with UDF

    #include "Extras\WM_NOTIFY.au3"

    #include <GUIConstantsEx.au3>
    #include <GuiSlider.au3>
    #include <StructureConstants.au3>
    #include <WindowsNotifsConstants.au3>

    Global $g_hSlider

    Example()

    Func Example()
        Local $hGUI

        ; Create GUI
        $hGUI = GUICreate("Slider Create (v" & @AutoItVersion & ")", 400, 296)
        $g_hSlider = _GUICtrlSlider_Create($hGUI, 2, 2, 396, 20, BitOR($TBS_TOOLTIPS, $TBS_AUTOTICKS))
        GUISetState(@SW_SHOW)

        _WM_NOTIFY_Register()

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

    Func WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam)
        #forceref $hWnd, $iMsg, $wParam
        Local $hWndSlider = $g_hSlider
        If Not IsHWnd($g_hSlider) Then $hWndSlider = GUICtrlGetHandle($g_hSlider)

        Local $tNMHDR = DllStructCreate($tagNMHDR, $lParam)
        Local $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
        Local $iCode = DllStructGetData($tNMHDR, "Code")
        Switch $hWndFrom
            Case $hWndSlider
                Switch $iCode
                    Case $NM_RELEASEDCAPTURE ; The control is releasing mouse capture
                        _WM_NOTIFY_DebugEvent("$NM_RELEASEDCAPTURE", $tagNMHDR, $lParam, "hWndFrom,IDFrom")
                        ; No return value
                EndSwitch
        EndSwitch
        Return $GUI_RUNDEFMSG
    EndFunc   ;==>WM_NOTIFY