Jump to content

Retrieving a GUIs Horz Scroll [Closed Pending further investigation]


Recommended Posts

*Update after hours of troubleshooting, i think i am barking up the wrong tree.
So not to waste anyone time, i am closing this for now.

 

Hi All,

I was wondering if there is a programmatic way to get the current x of a scrolled GUI?

In my code below, an example made from a larger script, every function of _GUIScrollBars_Get* returns 0.

_GUIScrollBars_GetScrollPos
_GUIScrollBars_GetScrollInfoTrackPos
_GUIScrollBars_GetScrollInfoPos

#NoTrayIcon
$DLLUser32 = DllOpen("user32.dll")
$iScrollTotal = 875
$iScrollCurrent = 0

$hGUI = GUICreate("Example", 500, 250, -1, -1)
GUICtrlCreateButton("Button 1", -125, 0, 125, 250)
GUICtrlCreateButton("Button 2", -375, 0, 125, 250)
GUISetState()

AdlibRegister("Idle", 10)

while 1
    Switch GUIGetMsg()
        Case -3
            Exit
    EndSwitch
WEnd

Func Idle()
    Scroll(1)
EndFunc

Func Scroll($iAmount)
    If $iScrollCurrent + $iAmount > $iScrollTotal Then $iAmount -= $iScrollTotal
    $iScrollCurrent += $iAmount
    
    DllCall($DLLUser32, "bool", "ScrollWindow", "hwnd", $hGUI, "int", $iAmount, "int", 0, "ptr", 0, "ptr", 0)
EndFunc


My current workaround is to store the info in a variable but now i need to branch this function between exes.

It would be much easier to be able to just retrieve the info from the GUI itself, rather then storing it in registry / writing to a file / sharing memory / creating a dummy GUI to hold the info / sending messages back & forth etc :)

Kind Regards,
Ian

 

P.S The reason i am moving the scroll animation to a separate exe is i want greater control over the animation speed. AdlibRegister has a minimum delay of 15ms and fluctuates between 10ms-20ms (which can look a little jittery). Using

$hDll=DllOpen("winmm.dll")
$hDll1=DllOpen("kernel32.dll")

DllCall( $hDll, "dword", "timeBeginPeriod", "int", 1 ) ; Steps = 1 ms
DllCall( $hDll1, "none", "Sleep", "int", 1)         ; Steps = 1 ms
DllCall( $hDll, "dword", "timeEndPeriod", "int", 1 )   ; Steps = 1 ms

I can get much shorter timings in regular intervals.

 

Edited by IanN1990
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...