Jump to content

_MouseTrap() in Client Area


CountyIT
 Share

Recommended Posts

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

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

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

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

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 game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

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