Juppie7 Posted July 11, 2008 Posted July 11, 2008 (edited) http://www.autoitscript.com/forum/index.php?showtopic=14643Anyone know why this won't work? I'm trying to set this to clip around my GUI's x,y,w,h coordinates, but it seems to do nothing, and returns no @error messages.... Just continues like nothing happened...This is what im working with:$r=DllStructCreate("int;int;int;int") DllStructSetData($r,1,$box_x) DllStructSetData($r,2,$box_y) DllStructSetData($r,3,$box_w) DllStructSetData($r,4,$box_h) $ret=DllCall("user32.dll","int","ClipCursor","ptr",DllStructGetPtr($r))where Box_x..Box_h are the x,y coords and w,h dimensions of my GUIAlso, if i msgbox the $ret[0], the function ClipCursor is returning 1 , so according to MSDN, it was successful. Why then, would it have no effect on the mouse? Edited July 11, 2008 by Juppie7
Andreik Posted July 11, 2008 Posted July 11, 2008 This is complet function: Func _MouseTrap($iLeft = 0, $iTop = 0, $iRight = 0, $iBottom = 0) Local $iResult, $tRect If @NumParams == 0 Then $iResult = DllCall("user32.dll", "int", "ClipCursor", "int", 0) Else If @NumParams == 2 Then $iRight = $iLeft + 1 $iBottom = $iTop + 1 EndIf $tRect = DllStructCreate($tagRect) If @error Then Return 0 DllStructSetData($tRect, "Left", $iLeft) DllStructSetData($tRect, "Top", $iTop) DllStructSetData($tRect, "Right", $iRight) DllStructSetData($tRect, "Bottom", $iBottom) $iResult = DllCall("user32.dll", "int", "ClipCursor", "ptr", DllStructGetPtr($tRect)) EndIf Return $iResult[0] <> 0 EndFunc Look in Misc.au3
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