Sign in to follow this  
Followers 0
Ontosy

BlockInput except Dx Click mouse

2 posts in this topic

Do it is possibile to disable all input KeyBoard + Mouse except Mouse Click Right to mantain a minimal control?

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

AutoIt doesn't allow you to "Block out" Input, only to intercept them.

What you could do is make a GUI and _MouseTrap() it in there and then make your own key handler using _IsPressed() and an event interceptor like the one below. For that script below just add some input boxes or something and see what the msgbox pops up when you type or click in them.

#include <GuiConstants.au3>

Global $WM_NOTIFY=0x004E
Global Const $NM_FIRST = 0
Global Const $NM_CLICK = ($NM_FIRST - 2)
Global Const $NM_DBLCLK = ($NM_FIRST - 3)

Opt("GUIResizeMode", 802)
Opt("GUIOnEventMode", 1)

$Gui = GuiCreate("your GUI",100,100,1,1)
GUISetOnEvent($GUI_EVENT_CLOSE, "SpecialEvents")
GUISetOnEvent($GUI_EVENT_MINIMIZE, "SpecialEvents")
GUISetOnEvent($GUI_EVENT_RESTORE, "SpecialEvents")
...
GUIRegisterMsg($WM_NOTIFY, "WM_Notify_Events")
...
GuiSetState()

While 1

Wend

Func WM_Notify_Events($hWndGUI, $MsgID, $wParam, $lParam)
    #forceref $hWndGUI, $MsgID, $wParam
    Local $tagNMHDR, $event
    $tagNMHDR = DllStructCreate("int;int;int", $lParam);NMHDR (hwndFrom, idFrom, code)
    If @error Then Return
    $event = DllStructGetData($tagNMHDR, 3)
    Select
        Case $wParam = $Control_Name; Handle of the control that you want to intercept events
            MsgBox(0x0,"Event Intercepeted 2", $event)
            Select
                Case $event = $NM_CLICK
           ;func1()
                Case $event = $NM_DBLCLK
           ;func2()
            EndSelect
    EndSelect
    $tagNMHDR = 0
    $event = 0
    $lParam = 0
EndFunc

Func SpecialEvents();Handle Close/Minimize/Maximize operations

    Select
        Case @GUI_CTRLID = $GUI_EVENT_CLOSE
            end()
        ;Case @GUI_CTRLID = $GUI_EVENT_MINIMIZE

        ;Case @GUI_CTRLID = $GUI_EVENT_RESTORE

    EndSelect

EndFunc
Edited by shadesdude

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