Hi, This UDF originaly started in this thread, on the latest post you can find rasim's examples and my initial BlockInputEx udf example. But eventualy i improved the UDF and i thought that it would be better to place it here, in Examples forum. This UDF supports few features that built-in BlockInput() function does not. Here is a quick "features list" if you can call it like this : Block seperately mouse or keyboard input.Block specific keyboard/mouse keys/clicks. [+] Not only hex keys are supported, string keys (such as {ENTER}) is also valid.Block all keyboard/mouse keys *except* specific keys/events.Block keys by CLASS Name (see UDF documentation).Block inputs only for specific window.BlockInput does not re-enables input after pressing Ctrl+Alt+Del.Note: This UDF, same as built-in BlockInput function, can not block Ctrl+Alt+Del, however, it will not re-enable the input. Example #1 (hWindows usage):
#include <BlockInputEx.au3>
;================== hWindows usage Example ==================
HotKeySet("{ESC}", "_Quit") ;This will trigger an exit (on any window except the window of Notepad).
Run(@WindowsDir & "\Notepad.exe", "", @SW_MAXIMIZE)
WinWait("[REGEXPCLASS:Notepad.*]")
$hNotepad_Wnd = WinGetHandle("[REGEXPCLASS:Notepad.*]")
ControlSetText($hNotepad_Wnd, "", "", _
"Now try to input some keys in here..." & @CRLF & _
"Well, that's the idea, you can't, don't you?" & @CRLF & @CRLF & ":)")
;Here we block *All* keyboard keys for specific window (in this case the Notepad's window).
_BlockInputEx(3, "", "", $hNotepad_Wnd)
;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
EndFuncExample #2 (CLASSes usage):
#include <BlockInputEx.au3>
;================== CLASSes usage Example ==================
HotKeySet("{ESC}", "_Quit");This will trigger an exit
;Here we block Numeric keyboard keys, "Test" string (every char in this group), and UP / DOWN arrow keys.
_BlockInputEx(3, "", "[:NUMBER:]|[Test]|{UP}|{DOWN}")
;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
EndFuncDownload (In the archive there is 11 nice examples including the two above): BlockInputEx_UDF_1.8.zip BlockInputEx_UDF_1.6.zip _BlockInputEx_UDF_1.5.zip _BlockInputEx_UDF_1.4.zip _BlockInputEx_UDF_1.3.zip _BlockInputEx_UDF_1.2.zip _BlockInputEx_UDF_1.1.zip _BlockInputEx_UDF.zip Enjoy! ================================================================= ChangeLog: