Function Reference


Create a Slider control

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


$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

$iExStyle [optional] Control extended style. These correspond to the standard $WS_EX_* constants. See Extended Style Table.

Return Value

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


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




Example : Created with UDF

#include <Extras\WM_NOTIFY.au3>
#include <GUIConstantsEx.au3>
#include <GuiSlider.au3>
#include <WindowsConstants.au3>

Global $g_hSlider


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))


        ; Loop until the user exits.
        Until GUIGetMsg() = $GUI_EVENT_CLOSE
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
        Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_NOTIFY