Sign in to follow this  
Followers 0
JPeters

Get Slider Position for non-MS Sliders

2 posts in this topic

I'm trying to get and set slider positions in a program that uses "Slider20WndClass" sliders, not the "msctls_trackbar32" that I understand _GUICtrlSliderGetPos was written for. The only information I could find on getting and setting slider positions in non-AutoIt GUIs suggested using _GUICtrlSliderGetPos. Here's the code I have currently:

#include <GUIConstants.au3>
#include <Misc.au3>
#Include <GuiSlider.au3>

Opt("WinTitleMatchMode", 2);set partial match mode for window titles
WinActivate("Calibration")
$h_slider=ControlGetHandle("Calibration", "", "[CLASSNN:Slider20WndClass1]")
$SliderPos=_GUICtrlSliderGetPos($h_slider)

$GUI=GUICreate("Slider Setting", 200, 100)
GUICtrlCreateLabel("Slider = " & $SliderPos, 50, 20, 150, 30, $SS_LEFT)
$OKButton = GUICtrlCreateButton("OK", 70, 50, 60)
GUISetState(@SW_SHOW)
While 1
  $msg = GUIGetMsg()
  IF $msg = $OKButton Then
      GUIDelete($GUI)
      ExitLoop
  Endif
WEnd

The slider position comes back as -1, which I assume is an error value, for all slider positions. Can anyone suggest a way to get/set the slider position for these sliders? Thanks in advance!

Share this post


Link to post
Share on other sites



Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0