2
votes

I am trying to leverage my mouse inside of a bluestacks app native to touch screen. Whenever I move the mouse too far to the edge, the emulator stops responding to mouse movements. I am hoping to create an autohotkey script that automatically "centers" the mouse upon boundary conditions so that it never reaches the edge of the screen.

A couple of problems I have seen is that the movement of the mouse is picked up whenever I tried to do a DLL call for position changes. What do you guys think?

1

1 Answers

2
votes

Here's a little script that uses ClipCursor to constrain the cursor to the active window. Use Win+V to toggle it on or off. You can read this topic, if you want: [Link].

#v::
  WinGetPos, X, Y, W, H, A
  ClipCursor(t:=!t,X,Y,X+W,Y+H)
return

ClipCursor( Confine=True, x1=0 , y1=0, x2=1, y2=1 ) {
  VarSetCapacity(R,16,0)
  NumPut(x1,&R+0)
  NumPut(y1,&R+4)
  NumPut(x2,&R+8)
  NumPut(y2,&R+12)
  Return Confine ? DllCall( "ClipCursor", UInt,&R ) : DllCall( "ClipCursor" )
}