Opened 16 years ago

Closed 16 years ago

#622 closed Feature Request (Rejected)


Reported by: Ken82m Owned by:
Milestone: Component: AutoIt
Version: Severity: None
Keywords: BlockInput Block Input Exception Cc:


This is written by another forum user, RASIM.

Here's the thread:

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

Func _UnBlock()
    MsgBox(0, "_UnBlock", "Input unblocked")

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)

Func _Mouse_Handler($nCode, $wParam, $lParam)
    If $nCode < 0 Then Return _WinAPI_CallNextHookEx($hHookMouse, $nCode, $wParam, $lParam)
    Return 1

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.


Attachments (0)

Change History (2)

comment:1 Changed 16 years ago by TicketCleanup

  • Version deleted

Automatic ticket cleanup.

comment:2 Changed 16 years ago by Valik

  • Resolution set to Rejected
  • Status changed from new to closed

This is just a little piece of example code. It's a long way from what it needs to be in order to even be considered for inclusion. Come back again when you have a function with documentation.

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

as closed The ticket will remain with no owner.

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.