Jump to content
Sign in to follow this  

MouseTrap issue

Recommended Posts



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:


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)
        If @NumParams == 2 Then
            $iRight = $iLeft + 1
            $iBottom = $iTop + 1
        $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))
    Return $iResult[0] <> 0

Look in Misc.au3

When the words fail... music speaks

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  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.