Jump to content

BlockInputEx UDF!


MrCreatoR
 Share

Recommended Posts

can you tell me more about your "ClipPut" information.

I am newbie.

I have just used: {MSDOWN}|{MSUP} for disable right mouse

 

ClipPut writes in the clipboard whatever you want.

So you can put ClipPut inside a loop and your script will let you copy (with the mouse or with Control+C with the keyboard) and inmediatly the content of the clilpboard will be changed with empty data.

Try this example:

#NoTrayIcon ;put this at the top of your script to don't show any tray icon

HotKeySet("{ESC}", "_Exit") ;If you press ESC the script will stop

While 1 ;the loop
    ClipPut("")
    Sleep (20) ; a little sleep to don't use a lot of cpu
Wend

Func _Exit() ;a little function to exit
Exit
EndFunc ;==> _Exit()

And while your script is running you'll never be able of paste anything.

Greets from Barcelona

Link to comment
Share on other sites

ClipPut writes in the clipboard whatever you want.

So you can put ClipPut inside a loop and your script will let you copy (with the mouse or with Control+C with the keyboard) and inmediatly the content of the clilpboard will be changed with empty data.

Try this example:

#NoTrayIcon ;put this at the top of your script to don't show any tray icon

HotKeySet("{ESC}", "_Exit") ;If you press ESC the script will stop

While 1 ;the loop
    ClipPut("")
    Sleep (20) ; a little sleep to don't use a lot of cpu
Wend

Func _Exit() ;a little function to exit
Exit
EndFunc ;==> _Exit()

And while your script is running you'll never be able of paste anything.

Greets from Barcelona

Value: i want more and more: ClipPut("{Ctrl}") but i need {Ctrl}, {AppsKey} = Context menu, rightmouse click, 

Link to comment
Share on other sites

Uuuuuh, sorry, could you please explain a little bit more what do you want to do?

Thanks

thank you so much because reply.

my case, i want disable: "Ctrl" and "AppsKey" (AppsKey = Context menu, it near Ctrl, it like click right mouse) and "rightmouse click"

 

Link to comment
Share on other sites

  • 6 months later...

Hi,

first of all. Very useful UDF. Thanks for sharing.

May I ask to extend this UDF a little bit. :)

It would be great and would solve a big problem for me when it would still be possible to send something with the SEND Command to (for example) a window,

because at the moment it seems that the UDF will block simply everything. I need/want still to send text via the SEND Command.

Thanks alot.

Kind Regards

Supergrobi

Link to comment
Share on other sites

  • 2 years later...

Hi all... thank you for this udf.

My problem is that I'm having the same issue than AcidUser mentioned a few posts ago. I'm testing a script on an rdp session and if I use Ctrl+Alt+Del I'm still able to unlock the input.

I'm using _BlockInputEx(1)

Can someone help me with this?

 

 

Link to comment
Share on other sites

Very nice sir.  I have always been a bit disappointed with the built in block input function.  Whenever I write a script meant for an end user and it requires manipulation of a window or its associated controls, I always block the input so they don't screw something up then call me wondering why.  However, if something ELSE were to happen (another window is focused, etc) then they are essentially stuck until they (CTRL + ALT + DEL).  BTW, I haven;t tried this yet, but is there a way to make it so that even when CTRL + ALT + DEL is pressed, even if the screen pops up, the input is still frozen when user cancels back to the desktop?  That would be useful also.

Link to comment
Share on other sites

  • 5 months later...

I have been using this script for years and have never figured out whit anyone would want to block input based on a Windows. There has never been a real good explanation of how that works. Even the examples are lacking in documentation. Does anyone block by Window and if so can you explain it to me?

Actually I might get lucky and get a response so I will elaborate a little. I want an overall block for everything but... if a certain Window is active I want to specify blocks for that specific Windows. So I am obviously going to have to allow double mouse clicks overall so users can open programs but at that point will the blocks for the active Window be in place until some other Window becomes active at which point it will revert to allowing just the double clock again?

 

Edited by Trax
Link to comment
Share on other sites

  • 1 year later...
  • 10 months later...
On 1/13/2010 at 12:13 AM, Homes32 said:

I am trying to block input to everything but a particular window. I have tried using the following code with no success. is this possible with your UDF? or is $hWindows only intended to control blocking FOR a specific window?

-Homes32

 

 

On 5/20/2013 at 6:52 AM, JohnOne said:

I've seen similar questions to this one asked "regarding windows" but as yet unanswered.

I'm wondering if it possible with your UDF's to accomplish the following...

Block UP DOWN LEFT RIGHT to all but autoit window.

The goal is to give these keys mouse functionality, but without interacting with any active windows such as scrolling a webpage or any other application specific tasks.

I think we need to detect the window by ourselves, then whenever the target window has Focus, just call `_BlockInputEx(0)` and when it's lost focus, lock again

Link to comment
Share on other sites

  • 11 months later...
On 8/4/2010 at 2:14 PM, MrCreatoR said:

... ;Here we block only tthishe following keyboard keys (try to press them ;)😞 pro ; 0x31 = "1" ; 0x32 = "2" ; 0x33 = "3" ; 0x61 = "Numpad1" ; 0x62 = "Numpad2" ; 0x63 = "Numpad3" ;_BlockInputEx(1, "", "0x31|0x32|0x33|0x61|0x62|0x63") _BlockInputEx(1, "", "1|2|3|{NUMPAD1}|{NUMPAD2}|{NUMPAD3}") ;The same as previous commented line ...

hello i have this problem can any one help please thancks  in the script wen i try to run it undefined function

 

Link to comment
Share on other sites

On 10/23/2010 at 2:34 PM, zwierzak said:

how to block ONLY ctrl+alt+del

hello thancks loocking for help in this srcipt wen i run this it give error in the red line say    undefined function

thanks

# include <BlockInputEx.au3>
    ;================== CLASSes usage Example ==================
HotKeySet("{ESC}", "_Quit") ;This will trigger an exit

_BlockInputEx(3,"", "{LCTRL}|{RCTRL}|{ALT}|{DEL}|^!+{DEL}")
;This is only for testing, so if anything go wrong, the script will exit after 10 seconds.

AdlibRegister("_Quit", 10000)
While 1
Sleep(100)
WEnd

Func _Quit()
Exit
EndFunc

Link to comment
Share on other sites

You CANNOT block ctrl-alt-del.  You can know if that sequence of keys has been pressed, but you cannot block it.  Make sense after all.

And please use this tool when you post code.  If you want a fast block input, see my sig....

Link to comment
Share on other sites

  • 2 months later...
  • 1 year later...

It always hard-crashes for me IF I use a window handle and IF  I'm trying to move the blocked mouse just before the unblock (_BlockInputEx(0)).

I modified the __BlockInputEx_UnhookWinHooks_Proc() function just a bit and it now works fine for me when I use a window handle

Original

;Releases callbacks and Unhook Windows hooks
Func __BlockInputEx_UnhookWinHooks_Proc()
    ;Release KeyBoard callback function
    If $ah_MouseKeyboard_WinHooks[0] > 0 Then
        DllCallbackFree($ah_MouseKeyboard_WinHooks[0])
        $ah_MouseKeyboard_WinHooks[0] = 0
    EndIf
    
    ;Release Mouse callback function
    If $ah_MouseKeyboard_WinHooks[1] > 0 Then
        DllCallbackFree($ah_MouseKeyboard_WinHooks[1])
        $ah_MouseKeyboard_WinHooks[1] = 0
    EndIf
    
    ;Release KeyBoard Window hook
    If IsPtr($ah_MouseKeyboard_WinHooks[2]) Then
        _WinAPI_UnhookWindowsHookEx($ah_MouseKeyboard_WinHooks[2])
        $ah_MouseKeyboard_WinHooks[2] = 0
    EndIf
    
    ;Release Mouse Window hook
    If IsPtr($ah_MouseKeyboard_WinHooks[3]) Then
        _WinAPI_UnhookWindowsHookEx($ah_MouseKeyboard_WinHooks[3])
        $ah_MouseKeyboard_WinHooks[3] = 0
    EndIf
    
    Return 1
EndFunc

 

Modified

;Releases callbacks and Unhook Windows hooks
Func __BlockInputEx_UnhookWinHooks_Proc()

    ;Release KeyBoard Window hook
    If IsPtr($ah_MouseKeyboard_WinHooks[2]) Then
        _WinAPI_UnhookWindowsHookEx($ah_MouseKeyboard_WinHooks[2])
        $ah_MouseKeyboard_WinHooks[2] = 0
    EndIf

    ;Release Mouse Window hook
    If IsPtr($ah_MouseKeyboard_WinHooks[3]) Then
        _WinAPI_UnhookWindowsHookEx($ah_MouseKeyboard_WinHooks[3])
        $ah_MouseKeyboard_WinHooks[3] = 0
    EndIf

    ;Release KeyBoard callback function
    If $ah_MouseKeyboard_WinHooks[0] > 0 Then
        DllCallbackFree($ah_MouseKeyboard_WinHooks[0])
        $ah_MouseKeyboard_WinHooks[0] = 0
    EndIf

    ;Release Mouse callback function
    If $ah_MouseKeyboard_WinHooks[1] > 0 Then
        DllCallbackFree($ah_MouseKeyboard_WinHooks[1])
        $ah_MouseKeyboard_WinHooks[1] = 0
    EndIf

    Return 1
EndFunc

 

It seems that the window hooks must be released before the callbacks are. 

Your oldest changelog entry mentioning a hard-crash with winhandles related to window hooks not being released gave me a clue.

Edited by Zehir
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...