Jump to content

Recommended Posts

  • 2 months later...
Posted (edited)

nice UDF!

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?

#include <BlockInputEx.au3>

;================== hWindows usage Example ==================

HotKeySet("{ESC}", "_Quit")

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 every window but Notepad's window
_BlockInputEx(3, "[:ALPHA:]|[:NUMBER:]|{ENTER}|{ALT}|{TAB}|{BACKSPACE}", "", $hNotepad_Wnd)

While 1
    Sleep(10000)
    _Quit()
WEnd

Func _Quit()
    Exit
EndFunc

-Homes32

Edited by Homes32
  • 3 months later...
Posted

I have a problem : when I use this on my script

_BlockInputEx(3, "[:ALPHA:]|[:NUMBER:]|{ENTER}|{BACKSPACE}","{LWIN}|{RWIN}|{DEL}|{LCTRL}|{RCTRL}|{ALT}|{TAB}|{F1}|{F2}|{F3}|{F4}|{F5}|{F6}|{F7}|{F8}|{F9}|{F10}|{F11}|{F12}")

Afterthat, these keys :LWIN, RWIN, DEL, LCTRL, RCTRL, ALT, TAB, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12 is blocked, although the script is ended!

  • 2 months later...
Posted

UDF updated!

History version:

  Quote

[v1.4 - 03.08.2010, 12:00]

+ AutoIt 3.3.6.1 support.

* Fixed an issue with held down "Alt + Ctrl" keys after the user was called "Alt + Ctrl + Del". It was causing a problems to use HotKeySet later.

* Fixed examples to be compatible with AutoIt 3.3.6.1.

* Minor "cosmetic" changes.

[v1.3 - 24.09.2009, 23:00]

+ Added _BlockInputEx Example (Pass Lock)

* Fixed few examples.

* Fixed spell mistakes in the UDF.

Please check the first post.

 

  Reveal hidden contents

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Posted

For those ho downloaded the last version, please re-download, i made one small fix (related to «issue with held down "Alt + Ctrl" keys»). The version is the same.

 

  Reveal hidden contents

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Posted (edited)

  On 8/4/2010 at 4:11 PM, 'MrCreatoR said:

For those ho downloaded the last version, please re-download, i made one small fix (related to «issue with held down "Alt + Ctrl" keys»). The version is the same.

I try _BlockInputEx Example (Include usage).au3 but i can use 1, 2, 3 num key Posted Image

Is it for all keyboard, like french Azerty ?

Edited by wakillon

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Posted (edited)

  On 8/4/2010 at 5:38 PM, 'wakillon said:

I try _BlockInputEx Example (Include usage).au3 but i can use 1, 2, 3 num key Posted Image

Is it for all keyboard, like french Azerty ?

So what is the problem? :blink: before you runing the examples, you might want to open the scripts and check the comments ;)

...

HotKeySet("1", "_Quit")
HotKeySet("2", "_Quit")
HotKeySet("3", "_Quit")

;Here we block only the following keyboard keys: 0x31 = "1", 0x32 = "2", 0x33 = "3" (try to press them ;) )
_BlockInputEx(1, "", "0x31|0x32|0x33")

...

scratch that, i thought you wrote that you can't use the keys...

All correct, the example includes only standard numbers, to include numpad keys we need to set different keys:

...

;Here we block only the following keyboard keys (try to press them ;) ):
; 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

...
Edited by MrCreatoR

 

  Reveal hidden contents

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Posted

  On 8/4/2010 at 7:14 PM, 'MrCreatoR said:

scratch that, i thought you wrote that you can't use the keys...

All correct, the example includes only standard numbers, to include numpad keys we need to set different keys:

...

;Here we block only the following keyboard keys (try to press them ;) ):
; 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

...

Ok it's work fine ! Posted Image

And sorry for the confusion...

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

  • 1 month later...
Posted (edited)

Hello,

is it possible to allow input to one window only and rest all windows are blocked?

The example shows blocking only Notepad and rest all other windows have been allowed the input.

on second thoughts:

If windowFocus is Notepad then enable only specific keys (eg numeric keypad) and specific mouse movements (restricted in a specific area)

Else if Notepad is out of focus then disable all keys except AltTAB

regards

Deltarocked

Edited by deltarocked
  • 2 weeks later...
Posted (edited)

Update...

ChangeLog:

  Quote

[v1.5 - 11.10.2010, 22:20]

* Fixed an issue with re-enabled input after pressing Ctrl+Alt+Del.

* Now the $hWindows parameter can be used for mouse blocking.

----For that reason the $i_MouseHookGetAncestorHwnd variable was added to the UDF,

----if user sets it to 0, then the $hWindows is compared to currently hovered window handle, otherwise (1 - default) it's compared to ancestor of the hovered window/control.

Please check the first post. Edited by MrCreatoR

 

  Reveal hidden contents

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

  • 2 weeks later...
Posted (edited)

Maybe I am stupid, but how to block ONLY ctrl+alt+del? I just cannot do it -.-

I've tried in both ways:

#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

I am using Windows 7 x64

Edited by zwierzak
Posted

I have to admit that for Windows 7 Ctrl + Alt + Del works different. It opens new screen with few options avaible. Any suggestions how to bypass it?

  • 1 month later...
Posted (edited)

  On 10/11/2010 at 8:29 PM, 'MrCreatoR said:

ChangeLog:

* Fixed an issue with re-enabled input after pressing Ctrl+Alt+Del.

MrCreator, any insight you can give into how you fixed the Ctrl+Alt+Del issue? I see the problem happening in Yashied's UDF, where the keyboard hook is completely lost after Ctrl-Alt-Del (at least in Windows 7), but it doesn't happen with your program.

Also, I believe there's an issue in your BlockInputEx.au3 code, line #195:

If $nCode < 0 Then Return _WinAPI_CallNextHookEx($ah_MouseKeyboard_WinHooks[4], $nCode, $wParam, $lParam)

You assign $ah_MouseKeyboard_WinHooks[4] to an inclusion string, so that call will fail. Elsewhere in that function you correctly use this:

_WinAPI_CallNextHookEx($ah_MouseKeyboard_WinHooks[2], $nCode, $wParam, $lParam)

Thanks for your help, and the cool UDF =)

Edited by Ascend4nt

My contributions:

  Reveal hidden contents

Performance Counters in Windows - Measure CPU, Disk, Network etc Performance | Network Interface Info, Statistics, and Traffic | CPU Multi-Processor Usage w/o Performance Counters | Disk and Device Read/Write Statistics | Atom Table Functions | Process, Thread, & DLL Functions UDFsProcess CPU Usage Trackers | PE File Overlay Extraction | A3X Script Extract | File + Process Imports/Exports Information | Windows Desktop Dimmer Shade | Spotlight + Focus GUI - Highlight and Dim for Eyestrain Relief | CrossHairs (FullScreen)Rubber-Band Boxes using GUI's (_GUIBox) | GUI Fun! | IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) | Magnifier (Vista+) Functions UDF | _DLLStructDisplay (Debug!) | _EnumChildWindows (controls etc) | _FileFindEx | _ClipGetHTML | _ClipPutHTML + ClipPutHyperlink | _FileGetShortcutEx | _FilePropertiesDialog | I/O Port Functions | File(s) Drag & Drop | _RunWithReducedPrivileges | _ShellExecuteWithReducedPrivileges | _WinAPI_GetSystemInfo | dotNETGetVersions | Drive(s) Power Status | _WinGetDesktopHandle | _StringParseParameters | Screensaver, Sleep, Desktop Lock Disable | Full-Screen Crash Recovery

Wrappers/Modifications of others' contributions:

_DOSWildcardsToPCRegEx (original code: RobSaunder's) | WinGetAltTabWinList (original: Authenticity)

UDF's added support/programming to:

_ExplorerWinGetSelectedItems | MIDIEx UDF (original code: eynstyne)

(All personal code/wrappers centrally located at Ascend4nt's AutoIT Code)

  • 3 months later...
Posted

ChangeLog:

  Quote

[v1.6 - 04.04.2011, 22:30]

* Fixed (again, caused by fix with re-enabled input) an issue with held down "Alt + Ctrl" keys after the user was called "Alt + Ctrl + Del".

* Fixed an issue with wrong parameter passed to _WinAPI_CallNextHookEx. Thanks to Ascend4nt.

+ Added remarks to the UDF header.

+ Added "Example - Block TaskMan.au3".

 

  Reveal hidden contents

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

  • 2 months later...
Posted

Hi MrCreator,

Thanks for your great work. I'm having problem with {`} (Grave Accent). I'm using winXP SP3. Here's my code

_BlockInputEx(3, "[:ALPHA:]|[:NUMBER:]|[:ARROWS:]|{SPACE}|{ENTER}|{BACKSPACE}|{INSERT}|{DEL}|{HOME}|{END}|{PGUP}|{PGDN}|{ESC}|{CTRL}|{SHIFT}|{CAPSLOCK}|{NUMLOCK}|{NUMPADDIV}|{NUMPADMULT}|{NUMPADSUB}|{NUMPADADD}|{NUMPADDOT}|{GRAVEACCENT}")

I've tried both {`} and {GRAVEACCENT} (as seen in the code) but none of them work. The Grave Accent in my environment is important as windows used it as a hotkey for switching language keyboard input. The less of the keys are fine.

Suggestion/advise are most welcom. Thanks in advance

Regards

Prakob

  • 4 months later...
Posted

  On 6/16/2011 at 8:54 PM, 'prakob said:

Thanks for your great work. I'm having problem with {`} (Grave Accent). I'm using winXP SP3. Here's my code

I've tried both {`} and {GRAVEACCENT} (as seen in the code) but none of them work. The Grave Accent in my environment is important as windows used it as a hotkey for switching language keyboard input. The less of the keys are fine.

Suggestion/advise are most welcom. Thanks in advance

Regards

Prakob

According to the example in the first post, you'd just use this structure instead ... |[`]"

Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

  • 1 month later...
Posted

  On 10/6/2009 at 7:09 PM, 'Emolas said:

Awesome script and very useful. Is there any way to get it to block USER mouse input but still enable script input via mousemove()?

  On 10/14/2009 at 9:53 AM, 'epicfail said:

i found a problem with this u cant have your script using mousemove when u have blocked the inputs.

Still not a feature? Can't seem to find anything in the examples.

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...