Sign in to follow this  
Followers 0
ludocus

BlockInput keyboard not mouse

4 posts in this topic

I want to blockinput the keyboard but not the mouse..

or I want to blockinput everything and then be able to know if anything is pressed...

I don't know how to do this, some help please?

Share this post


Link to post
Share on other sites



I want to blockinput the keyboard but not the mouse..

or I want to blockinput everything and then be able to know if anything is pressed...

I don't know how to do this, some help please?

I was curious about this also...lemme know if you figure something out...you'd probably have to look @ an example on http://msdn.microsoft.com/en-us/library/default.aspx then convert it to autoit... oh, and I will be on msn tomorrow around 1:00 my time :)


[u][font="Century Gothic"]~я α и d γ ĵ . ċ . ѕ қ ϊ и и ε я~- My Programs -auto shutdownSleep funcdisallow programs[/font][/u]

Share this post


Link to post
Share on other sites

ludocus

ReaImDown

For blocking keyboard you need to hook keypressings:

#include <WindowsConstants.au3>

Global Const $WH_KEYBOARD_LL = 13

Global $pStub_KeyProc = DllCallbackRegister("_KeyProc", "int", "int;ptr;ptr")
Global $hmod = DllCall("kernel32.dll","hwnd","GetModuleHandle","ptr",0)

MsgBox(4096, "", 'After pressing a "Ok" button keyboard has blocked')

Global $hHook = DllCall("user32.dll", "hwnd", "SetWindowsHookEx", _
                        "int", $WH_KEYBOARD_LL, _
                        "ptr", DllCallbackGetPtr($pStub_KeyProc), _
                        "hwnd", $hmod[0], _
                        "dword", 0)

While 1
    Sleep(50)
WEnd

DllCallbackFree($pStub_KeyProc)
DllCall("user32.dll","int","UnhookWindowsHookEx","hwnd",$hHook[0])

Func _KeyProc($nCode, $wParam, $lParam)
    If $nCode < 0 Then
        Local $aRet = DllCall("user32.dll", "long", "CallNextHookEx", "hwnd", $hHook, "int", $nCode, "wparam", $wParam, _
                          "lparam", $lParam)
        Return $aRet[0]
    EndIf
    
    Return 1
EndFunc

Share this post


Link to post
Share on other sites

ludocus

ReaImDown

For keyboard blocking you need to hook keypressing:

#include <WindowsConstants.au3>

Global Const $WH_KEYBOARD_LL = 13

Global $pStub_KeyProc = DllCallbackRegister("_KeyProc", "int", "int;ptr;ptr")
Global $hmod = DllCall("kernel32.dll","hwnd","GetModuleHandle","ptr",0)

MsgBox(4096, "", 'After pressing a "Ok" button keyboard has blocked')

Global $hHook = DllCall("user32.dll", "hwnd", "SetWindowsHookEx", _
                        "int", $WH_KEYBOARD_LL, _
                        "ptr", DllCallbackGetPtr($pStub_KeyProc), _
                        "hwnd", $hmod[0], _
                        "dword", 0)

While 1
    Sleep(50)
WEnd

DllCallbackFree($pStub_KeyProc)
DllCall("user32.dll","int","UnhookWindowsHookEx","hwnd",$hHook[0])

Func _KeyProc($nCode, $wParam, $lParam)
    If $nCode < 0 Then
        Local $aRet = DllCall("user32.dll", "long", "CallNextHookEx", "hwnd", $hHook, "int", $nCode, "wparam", $wParam, _
                          "lparam", $lParam)
        Return $aRet[0]
    EndIf
    
    Return 1
EndFunc

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