CountyIT Posted November 17, 2012 Share Posted November 17, 2012 I have a script that _MouseTraps() within the entire window. Works quite well. What I want to do, however, is _MouseTrap() in the Client Area. The one thread I did find only said that the example did just that but I can't find the example that was referred to. Playing with the AutoItSetOption("MouseCoordMode", 1) ;1=absolute, 0=relative, 2=client doesn't seem to effect where the mouse is trapped. It is always trapped in the whole window. I am using WinGetPos and Mouse Trapping on the results. Can someone point me to an example or documentation on how to MouseTrap in the Client Area? Thanks! Link to comment Share on other sites More sharing options...
JohnOne Posted November 17, 2012 Share Posted November 17, 2012 _WinAPI_GetClientRect() <- help file And use results of that. 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...
CountyIT Posted November 18, 2012 Author Share Posted November 18, 2012 No joy. I have a small notepad window. Left, Right, Top and Bottom are 0 547 0 394 No matter where I move that notepad window Left, right, top and bottom never change. Can't mouse trap on that. If I shrink or expand the windows the right and bottom change but the left and top are always 0,0 Link to comment Share on other sites More sharing options...
JohnOne Posted November 18, 2012 Share Posted November 18, 2012 Then use wingetpos, _WinAPI_GetClientWidth and _WinAPI_GetClientHeight. And a bit of maths. 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...
CountyIT Posted November 21, 2012 Author Share Posted November 21, 2012 I think a little confusion comes from the coordinates returned by the GetClient area functions. It always returns 0,0 for the upper left. That is fine but .... how do you MouseTrap relitive to a Window and not the full screen? Is there a better mouse trap LOL? Link to comment Share on other sites More sharing options...
JohnOne Posted November 21, 2012 Share Posted November 21, 2012 (edited) The x and y might be zero, but the width and height are not. borderwidth = (Windowwidth - Clientwidth) / 2 Gives you your borderwidth (if any) Clientx = Windowx + borderwidth You see where this is going. Edited November 21, 2012 by JohnOne 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...
kaotkbliss Posted November 21, 2012 Share Posted November 21, 2012 Let me get this straight, you want to $pos = WinGetPos("win title") _MouseTrap($pos[0],$pos[1],$pos[0]+$pos[2],$pos[1]+$pos[3]) ? 010101000110100001101001011100110010000001101001011100110010000 001101101011110010010000001110011011010010110011100100001 My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek We're gonna need another Timmy! 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