Jump to content

dllcall for scrollwindowex


Recommended Posts

My background: I am relatively new to Autoit, and don't have a programing background, but I have done a little bit with FORTRAN and Matlab for mathematical modeling. This has helped in understanding Autoit.

What I am trying to do is use 'ScrollWindowEx' to scroll a control in an inactive window, but I can't seem to make it work. I have looked at examples, played around with my code, searched google and the forums and still can't seem to get it working. My code is obtaining the window and control handles properly. Here is my code:

$MPos = MouseGetPos()
$ctrl = DllCall("user32.dll", "hwnd", "WindowFromPoint", "long", $MPos[0], "long", $MPos[1]) ; gets the control handle
$ctrlPS = ControlGetPos($windowHandle,"",$ctrl[0])
$RECT1 = DllStructCreate("int;int;int;int")
$RECT2 = DllStructCreate("int;int;int;int")
$amnt = 3
$NewBtm = $ctrlPS[1]+$amnt
DllStructSetData($RECT1, 1, $ctrlPS[0])
DllStructSetData($RECT1, 2, $ctrlPS[1])
DllStructSetData($RECT1, 3, $ctrlPS[2])
DllStructSetData($RECT1, 4, $ctrlPS[3])
DllStructSetData($RECT2, 1, $ctrlPS[0])
DllStructSetData($RECT2, 2, $ctrlPS[1])
DllStructSetData($RECT2, 3, $ctrlPS[2]+1)
DllStructSetData($RECT2, 4, $NewBtm+1)
$ptr1 = DllStructGetPtr($RECT1)
$ptr2 = DllStructGetPtr($RECT2)
;~$catch = DllCall("user32.dll","int","ScrollWindowEx","hwnd",$ctrl[0],"int",0,"int",$amnt,"int",$RECT1,"int",$RECT2,"int",0,"int",0,"dword","")
$catch = DllCall("user32.dll","int","ScrollWindowEx","hwnd",$ctrl[0],"int",0,"int",$amnt,"ptr",$ptr1,"ptr",$ptr2,"int",0,"int",0,"dword","")

The line that is commented out will actually scroll the window, but it will not redraw the invalidated area, and without calling 'UpdateWindow' it will snap back to where is was before trying to scroll it. The active line doesn't do anything.

Any help is appreciated!

Link to comment
Share on other sites

  • 2 weeks later...

Thanks John. You're right, my RECT's were wrong. I didn't understand what was meant by "clipping rectangle" and such. I am able to "scroll" the contents of the control, but I'm still having problems with drawing the new content and moving the scroll bar. I assume those are two seperate tasks that need to be completed. Hopefully I will figure it out soon.

Sorry for my late reply. Thanks again!

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