Sign in to follow this  
Followers 0
GodlessSinner

Why _MouseTrap wan't work correctly for me?

4 posts in this topic

#1 ·  Posted (edited)

 
#include <GUIConstantsEx.au3>
#include <Misc.au3>
HotKeySet("+!d", "ShowMessage") ;Shift-Alt-d
;_Main()
$on = False
Local $GUI, $coords[4]


While 1
$coords = WinGetPos(WinGetTitle("", ""))
If($on) Then
  _MouseTrap($coords[0] + 50, $coords[1]+50, $coords[0] + $coords[2]-50, $coords[1] + $coords[3]-50)
Else
_MouseTrap()
EndIf
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
Case Else
;;;
EndSwitch
WEnd
_MouseTrap()
Exit
Func ShowMessage()
    If($on) Then
$on = False
Else
$on = True
EndIf
EndFunc   ;==>ShowMessage

For some reason(2 monitors) I need to trap mouse in smaller rectangle, NOT in entire window, but + and -50 not affect on it.

Please, help.

 

EDIT: Even _MouseTrap(50, 50, 100, 100) doesn't work - it's traps ONLY to full size of active window.

Edited by GodlessSinner

_____________________________________________________________________________

Share this post


Link to post
Share on other sites



Strange, I'm running Win7 x64 with three monitors and on all three this script is working as expected...

Share this post


Link to post
Share on other sites

It was my error, I forgot to close old exe. Sorry..


_____________________________________________________________________________

Share this post


Link to post
Share on other sites

It was my error, I forgot to close old exe. Sorry..

No worries, I'm glad you got it working.

Perhaps toss _Singleton() in to your script so that another user doesn't run in to the same issue.

1 person likes this

Share this post


Link to post
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
Sign in to follow this  
Followers 0