Sign in to follow this  
Followers 0
Juppie7

MouseTrap issue

3 posts in this topic

#1 ·  Posted (edited)

http://www.autoitscript.com/forum/index.php?showtopic=14643

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

Also, 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 by Juppie7

Share this post


Link to post
Share on other sites



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


When the words fail... music speaks

Share this post


Link to post
Share on other sites

thanks you's

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