#include <GUIConstantsEx.au3>
#include <SliderConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <GuiSlider.au3>
#include <ScrollBarConstants.au3>
#Region gui
$max = 12345
$min = 0
$hwin = GUICreate("Test", 550, 100)
$Slider1 = GUICtrlCreateSlider(10, 7, 530, 25, $TBS_NOTICKS)
_GUICtrlSlider_SetRange($Slider1, $min, $max)
_GUICtrlSlider_SetPageSize($Slider1, 0)
GUISetState(@SW_SHOW)
#EndRegion gui
$test_num = 0
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
Exit
Case $GUI_EVENT_PRIMARYDOWN
$test_num += 1
ConsoleWrite($test_num & " _ " & _SetValue($Slider1, $hwin, $min, $max) & " `` " & _GUICtrlSlider_GetPos($Slider1) & @CRLF);test
EndSwitch
WEnd
Func _SetValue($iControl, $iwin, $imin, $imax)
$a = GUIGetCursorInfo($iwin)
$cpos = ControlGetPos('', '', $iControl)
$corect = _GUICtrlSlider_GetThumbLength($iControl)
$its_pos = "not"
If $a[4] = $iControl And $a[2] = 1 Then
$its_pos = ($a[0] - $corect) / (($cpos[2] - $corect) / $imax)
If $its_pos > $imax Then $its_pos = $imax
If $its_pos < $imin Then $its_pos = $imin
_GUICtrlSlider_SetPos($iControl, $its_pos)
Return _GUICtrlSlider_GetPos($iControl)
EndIf
EndFunc ;==>_SetValue