monkeybuttons Posted March 2, 2012 Share Posted March 2, 2012 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 More sharing options...
monkeybuttons Posted March 5, 2012 Author Share Posted March 5, 2012 Maybe my question wasn't clear. Here is what I am looking for: Am I using DllCall correctly? Am I using 'ScrollWindowEx' correctly? Is there anything wrong with the structs that I am trying to pass to 'ScrollWindowEx'? Thanks for any help. Link to comment Share on other sites More sharing options...
JohnOne Posted March 5, 2012 Share Posted March 5, 2012 I'm not sure your RECTs are correct look up $tagRECT in help file. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
monkeybuttons Posted March 13, 2012 Author Share Posted March 13, 2012 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now