Jump to content

Turn of Mouse buttons


 Share

Recommended Posts

You could get the Coords. of your window then get the Coords. of your mouse and Set a action for the mouse clicks when then meet. Or just set action for the mouse click when your Guis window is active. I would just hide the mouse when my window is active personally. with

GUISetCursor ( [cursorID [, override [, winhandle]]] )

CursorId = 16 will hide the mouse cursor.

Lookup Functions

MouseDown

MouseGetPos

MouseCoordMode

Edited by lordicast
[Cheeky]Comment[/Cheeky]
Link to comment
Share on other sites

You could get the Coords. of your window then get the Coords. of your mouse and Set a action for the mouse clicks when then meet. Or just set action for the mouse click when your Guis window is active. I would just hide the mouse when my window is active personally. with

GUISetCursor ( [cursorID [, override [, winhandle]]] )

CursorId = 16 will hide the mouse cursor.

Lookup Functions

MouseDown

MouseGetPos

MouseCoordMode

hide the mouse cursor doesn't disable mouse clicks.

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Link to comment
Share on other sites

Try this

#include <MouseSetOnEvent_UDF.au3>

Global $_GuiHandle = GUICreate ( '' )
$Button_1 = GUICtrlCreateButton ( "Button1", 10, 30, 100 )
GUISetState ( )
$_MouseOverOld=0

While 1
    $_Msg = GUIGetMsg ( )
    Switch $_Msg
        Case -3
            Exit
        Case $Button_1
            ConsoleWrite ( "Button1" & @Crlf )
    EndSwitch
    $_MouseOver = _IsMouseOverWindow ( $_GuiHandle, 1 )
    If $_MouseOver <> $_MouseOverOld Then
        Switch $_MouseOver
            Case 1
                ;GUISetCursor ( 16, 1, $_GuiHandle )
                _BlockMouseClicksInput ( 0 )
            Case Else
               ; GUISetCursor ( 2, 1, $_GuiHandle )
                _BlockMouseClicksInput ( 1 )
        EndSwitch
        $_MouseOverOld = $_MouseOver
    EndIf
WEnd

Func _BlockMouseClicksInput ( $iOpt=0 )
    If $iOpt = 0 Then
        _MouseSetOnEvent ( $MOUSE_PRIMARYUP_EVENT, "__Dummy" )
        _MouseSetOnEvent ( $MOUSE_PRIMARYDOWN_EVENT, "__Dummy" )
        _MouseSetOnEvent ( $MOUSE_SECONDARYUP_EVENT, "__Dummy" )
        _MouseSetOnEvent ( $MOUSE_SECONDARYDOWN_EVENT, "__Dummy" )
    Else
        _MouseSetOnEvent ( $MOUSE_PRIMARYUP_EVENT )
        _MouseSetOnEvent ( $MOUSE_PRIMARYDOWN_EVENT )
        _MouseSetOnEvent ( $MOUSE_SECONDARYUP_EVENT )
        _MouseSetOnEvent ( $MOUSE_SECONDARYDOWN_EVENT )
    EndIf
EndFunc ;==> _BlockMouseClicksInput ( )

Func _IsMouseOverWindow ( $_GuiHwnd, $_Active=0 )
    $_WinGetPos = WinGetPos ( $_GuiHwnd )
    If @error Then Return 0
    $_MouseGetPos = MouseGetPos ( )
    If @error Then Return 0
    If $_MouseGetPos[0] > $_WinGetPos[0] And $_MouseGetPos[0] < $_WinGetPos[0]+$_WinGetPos[2] And _
    $_MouseGetPos[1] > $_WinGetPos[1] And $_MouseGetPos[1] < $_WinGetPos[1]+$_WinGetPos[3] Then
        If $_Active Then
            $_WinState = WinGetState ( $_GuiHwnd )
            If BitAnd ( $_WinState, 8 ) Then
                Return 1
            Else
                Return 0
            EndIf
        Else
            Return 1
        EndIf
    EndIf
EndFunc ;==> _IsMouseOverWindow ( )
Edited by wakillon

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...