﻿id	summary	reporter	owner	description	type	status	milestone	component	version	severity	resolution	keywords	cc
622	_BlockInputExc	Ken82m		"This is written by another forum user, RASIM.

Here's the thread:
http://www.autoitscript.com/forum/index.php?showtopic=82650

And the code:
{{{
#include <WinAPI.au3>

HotKeySet(""{F3}"", ""_UnBlock"")

Global $pStub_KeyProc = DllCallbackRegister(""_KeyProc"", ""int"", ""int;ptr;ptr"")
Global $pStub_MouseProc = DllCallbackRegister (""_Mouse_Handler"", ""int"", ""int;ptr;ptr"")

MsgBox(0, """", 'Now we block mouse and all keyboard keys except a ""F3""')

Global $hHookKeyboard = _WinAPI_SetWindowsHookEx($WH_KEYBOARD_LL, DllCallbackGetPtr($pStub_KeyProc), _WinAPI_GetModuleHandle(0), 0)
Global $hHookMouse = _WinAPI_SetWindowsHookEx($WH_MOUSE_LL, DllCallbackGetPtr($pStub_MouseProc), _WinAPI_GetModuleHandle(0), 0)

While 1
    Sleep(100)
WEnd

Func _UnBlock()
    DllCallbackFree($pStub_KeyProc)
    DllCallbackFree($pStub_MouseProc)
    _WinAPI_UnhookWindowsHookEx($hHookKeyboard)
    _WinAPI_UnhookWindowsHookEx($hHookMouse)
    MsgBox(0, ""_UnBlock"", ""Input unblocked"")
    Exit
EndFunc

Func _KeyProc($nCode, $wParam, $lParam)
    If $nCode < 0 Then Return _WinAPI_CallNextHookEx($hHookKeyboard, $nCode, $wParam, $lParam)
    
    Local $KBDLLHOOKSTRUCT = DllStructCreate(""dword vkCode;dword scanCode;dword flags;dword time;ptr dwExtraInfo"", $lParam)
    Local $vkCode = DllStructGetData($KBDLLHOOKSTRUCT, ""vkCode"")
    
    If $vkCode <> 0x72 Then Return 1
    
    _WinAPI_CallNextHookEx($hHookKeyboard, $nCode, $wParam, $lParam)
EndFunc

Func _Mouse_Handler($nCode, $wParam, $lParam)
    If $nCode < 0 Then Return _WinAPI_CallNextHookEx($hHookMouse, $nCode, $wParam, $lParam)
    
    Return 1
EndFunc
}}}

I would love to see this added as parms to blockinput or a user defined function. It allows you to do a BlockInput but make exceptions for certain keys.

Whether to block the mouse or keyboard could also be made an option eaily.

-Kenny"	Feature Request	closed		AutoIt		None	Rejected	BlockInput Block Input Exception	
