Jump to content



Photo

BlockInput except for HotkeySet or specific keys? [Solved/Recommended Function]


  • Please log in to reply
27 replies to this topic

#1 ken82m

ken82m

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 623 posts

Posted 15 October 2008 - 02:47 AM

Looks like it's been asked but not in a while. Thought their may be a possible solution.

I have a hotkey specified to kill a script (F3 right now but I don't care which one).
I need to block input but do want to allow the user to press F3 to kill it.

Anyone have any ideas?
___________________________

If this is not possible quick question.

I haven't had time to test it yet.
It I lock the mouse in one position using _MouseTrap will that effect AutoIT's ability to move the mouse?

Thanks,

Kenny

Edited by ken82m, 15 October 2008 - 08:32 PM.

My ContributionsPC Builders Console - Secure PDF Creator - Cisco VPN Installer MS DNS Server Backup Script - MS DHCP Backup Script IT Admin Console - Toggle Admin Mode - MyMovies-Add Discs ScriptIT Help Desk and System Information ToolSet On Lid Close Power Option - Streaming Media Server & Website”I believe that when we leave a place, part of it goes with us and part of us remains... Go anywhere, when it is quiet, and just listen.. After a while, you will hear the echoes of all our conversations, every thought and word we've exchanged.... Long after we are gone our voices will linger in these walls for as long as this place remains.”





#2 ken82m

ken82m

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 623 posts

Posted 15 October 2008 - 03:00 AM

Found this on google: http://www.autohotkey.com/docs/commands/Input.htm

And they have source code maybe the devs could take a look :P
http://www.autohotkey.com/download/AutoHotkey_source.exe

The basic idea would seem like a useful function, or addition to BlockInput :(


Thanks,

Kenny
My ContributionsPC Builders Console - Secure PDF Creator - Cisco VPN Installer MS DNS Server Backup Script - MS DHCP Backup Script IT Admin Console - Toggle Admin Mode - MyMovies-Add Discs ScriptIT Help Desk and System Information ToolSet On Lid Close Power Option - Streaming Media Server & Website”I believe that when we leave a place, part of it goes with us and part of us remains... Go anywhere, when it is quiet, and just listen.. After a while, you will hear the echoes of all our conversations, every thought and word we've exchanged.... Long after we are gone our voices will linger in these walls for as long as this place remains.”

#3 rasim

rasim

    Gray Scripter

  • Active Members
  • PipPipPipPipPipPip
  • 1,708 posts

Posted 15 October 2008 - 05:47 AM

ken82m
You can use a keyboard hook. Example:
AutoIt         
#include <WinAPI.au3> HotKeySet("{F3}", "_MyFunc") Global $pStub_KeyProc = DllCallbackRegister("_KeyProc", "int", "int;ptr;ptr") MsgBox(0, "", 'Now we block all keyboard keys except a "F3"') Global $hHook = _WinAPI_SetWindowsHookEx($WH_KEYBOARD_LL, DllCallbackGetPtr($pStub_KeyProc), _WinAPI_GetModuleHandle(0), 0) While 1     Sleep(100) WEnd Func _MyFunc()     MsgBox(0, "MyFunc", "Function called by F3") EndFunc Func _KeyProc($nCode, $wParam, $lParam)     If $nCode < 0 Then Return _WinAPI_CallNextHookEx($hHook, $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($hHook, $nCode, $wParam, $lParam) EndFunc Func OnAutoitExit()     DllCallbackFree($pStub_KeyProc)     _WinAPI_UnhookWindowsHookEx($hHook) EndFunc

:P
OS: Windows XP SP3, AutoIt version: 3.3.0.0Posted Image My Projects: Free_Resources | Splitter | wgetGUI | UnRARIt | USBMon | CDROM-Control | Volume Serial Changer | WinTrayPosted Image My UDFs: _ScreenSetting | ListView_Progress | ContextHelp | ToolTip_UDF | UnRAR | Zip32 | BassMod | ShellTreeView | GuiHotKey | 7ZipPosted Image My Examples: TrayIcon_Click | SystemTray_Refresh | _ListView_Sort | CPUmonLike above scripts? Please rate the topic Posted Image

#4 ken82m

ken82m

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 623 posts

Posted 15 October 2008 - 06:12 AM

beautiful, thanks :P

I won't ask you to explain all that most of the commands I have no idea how to use lol.
But I'm assuming 0x72 is referring to F3 ?

I see 72 is the identifier for F3 in _IsPressed.
So I could use say 0x73 for the letter F4 ?

And if I wanted multiple keys I could use:
If $vkCode <> 0x72 AND $vkCode <> 0x73 Then Return 1
__________________________________________

Now I'm not using block input so anyone know how to kill the mouse without affecting MouseMove/MouseClick commands?

Thanks,

Kenny

Edited by ken82m, 15 October 2008 - 07:18 AM.

My ContributionsPC Builders Console - Secure PDF Creator - Cisco VPN Installer MS DNS Server Backup Script - MS DHCP Backup Script IT Admin Console - Toggle Admin Mode - MyMovies-Add Discs ScriptIT Help Desk and System Information ToolSet On Lid Close Power Option - Streaming Media Server & Website”I believe that when we leave a place, part of it goes with us and part of us remains... Go anywhere, when it is quiet, and just listen.. After a while, you will hear the echoes of all our conversations, every thought and word we've exchanged.... Long after we are gone our voices will linger in these walls for as long as this place remains.”

#5 ken82m

ken82m

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 623 posts

Posted 15 October 2008 - 06:23 AM

Just noticed one small problem.

It blocks all the keys but F3 - Perfect

I hit F3 I get the MSGBOX - Perfect

My keyboard still doesn't work though. Once I click okay on the msgbox with my mouse the script exits and then I get my keyboard back.
My ContributionsPC Builders Console - Secure PDF Creator - Cisco VPN Installer MS DNS Server Backup Script - MS DHCP Backup Script IT Admin Console - Toggle Admin Mode - MyMovies-Add Discs ScriptIT Help Desk and System Information ToolSet On Lid Close Power Option - Streaming Media Server & Website”I believe that when we leave a place, part of it goes with us and part of us remains... Go anywhere, when it is quiet, and just listen.. After a while, you will hear the echoes of all our conversations, every thought and word we've exchanged.... Long after we are gone our voices will linger in these walls for as long as this place remains.”

#6 rasim

rasim

    Gray Scripter

  • Active Members
  • PipPipPipPipPipPip
  • 1,708 posts

Posted 15 October 2008 - 08:35 AM

ken82m
I won't ask you to explain all that most of the commands

Google and the searching on this forum your friends. :(

ken82m
And if I wanted multiple keys I could use:
If $vkCode <> 0x72 AND $vkCode <> 0x73 Then Return 1

Yes.

ken82m
My keyboard still doesn't work though. Once I click okay on the msgbox with my mouse the script exits and then I get my keyboard back.

Extended example with mouse blocking:
AutoIt         
#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

:P
OS: Windows XP SP3, AutoIt version: 3.3.0.0Posted Image My Projects: Free_Resources | Splitter | wgetGUI | UnRARIt | USBMon | CDROM-Control | Volume Serial Changer | WinTrayPosted Image My UDFs: _ScreenSetting | ListView_Progress | ContextHelp | ToolTip_UDF | UnRAR | Zip32 | BassMod | ShellTreeView | GuiHotKey | 7ZipPosted Image My Examples: TrayIcon_Click | SystemTray_Refresh | _ListView_Sort | CPUmonLike above scripts? Please rate the topic Posted Image

#7 Mojo

Mojo

    Wayfarer

  • Active Members
  • Pip
  • 89 posts

Posted 15 October 2008 - 11:36 AM

@rasim

You are an AutoIt God! :P


I never imagined that this was possible! Thanks for sharing it!
You can fool some of the people all of the time, and all of the people some of the time, but you can not fool all of the people all of the time. Abraham Lincoln - http://www.ae911truth.org/ - http://www.freedocumentaries.org/

#8 ken82m

ken82m

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 623 posts

Posted 15 October 2008 - 08:27 PM

Yes without a doubt a true god :(
If I had the frequent flyer miles I'd buy you a beer lol

Thank you very much!
Definitely needs to be added to the next beat build or two in my opinion. :P

-Kenny

EDIT: Submitted feature request with a link to this thread. Ticket# 622

Edited by ken82m, 15 October 2008 - 08:44 PM.

My ContributionsPC Builders Console - Secure PDF Creator - Cisco VPN Installer MS DNS Server Backup Script - MS DHCP Backup Script IT Admin Console - Toggle Admin Mode - MyMovies-Add Discs ScriptIT Help Desk and System Information ToolSet On Lid Close Power Option - Streaming Media Server & Website”I believe that when we leave a place, part of it goes with us and part of us remains... Go anywhere, when it is quiet, and just listen.. After a while, you will hear the echoes of all our conversations, every thought and word we've exchanged.... Long after we are gone our voices will linger in these walls for as long as this place remains.”

#9 MrCreatoR

MrCreatoR

    Must AutoIt!

  • MVPs
  • 3,241 posts

Posted 16 October 2008 - 12:12 AM

Good example rasim!

Here is a UDF style :P

AutoIt         
#include <WinAPI.au3> HotKeySet("{ESC}", "_Quit") HotKeySet("{F1}", "_Quit") HotKeySet("{F2}", "_Quit") HotKeySet("{F3}", "_Quit") HotKeySet("{F4}", "_Quit") Global $ah_Hooks = _BlockInputEx(1, -1, "0x1B|0x70|0x71|0x72|0x73") ;0x1B={ESC},0x70="{F1}",0x71="{F2}",0x72="{F3}",0x73="{F4}" AdlibEnable("_Quit", 10000) ;This is only for testing, so if anything go wrong, the script will exit after 10 seconds. While 1     Sleep(100) WEnd Func _Quit()     _BlockInputEx($ah_Hooks)         Exit EndFunc ;$iBlockMode Option: ;                    -1 - Block All ;                    0  - Block only mouse ;                    1  - Block only keyboard Func _BlockInputEx($ah_Block_Hooks=0, $iBlockMode=-1, $sExclude="")     Select         Case IsArray($ah_Block_Hooks)             If $ah_Block_Hooks[1] > 0 Then DllCallbackFree($ah_Block_Hooks[1])             If $ah_Block_Hooks[2] > 0 Then DllCallbackFree($ah_Block_Hooks[2])                         If $ah_Block_Hooks[3] > 0 Then _WinAPI_UnhookWindowsHookEx($ah_Block_Hooks[3])             If $ah_Block_Hooks[4] > 0 Then _WinAPI_UnhookWindowsHookEx($ah_Block_Hooks[4])                         Return 1         Case IsNumber($ah_Block_Hooks) And $ah_Block_Hooks > 0             Local $pStub_KeyProc = 0, $pStub_MouseProc = 0, $hHookKeyboard = 0, $hHookMouse = 0                         If $iBlockMode = -1 Or $iBlockMode = 0 Then                 $pStub_MouseProc = DllCallbackRegister("_Mouse_Proc", "int", "int;ptr;ptr")                 $hHookMouse = _WinAPI_SetWindowsHookEx($WH_MOUSE_LL, DllCallbackGetPtr($pStub_MouseProc), _                     _WinAPI_GetModuleHandle(0), 0)             EndIf                         If $iBlockMode = -1 Or $iBlockMode = 1 Then                 $pStub_KeyProc = DllCallbackRegister("_Key_Proc", "int", "int;ptr;ptr")                 $hHookKeyboard = _WinAPI_SetWindowsHookEx($WH_KEYBOARD_LL, DllCallbackGetPtr($pStub_KeyProc), _                     _WinAPI_GetModuleHandle(0), 0)             EndIf                         Local $aRet[5] = ["|" & $sExclude & "|", $pStub_KeyProc, $pStub_MouseProc, $hHookKeyboard, $hHookMouse]                         Return $aRet         Case Else             Return SetError(1, 0, 0)     EndSelect EndFunc Func _Key_Proc($nCode, $wParam, $lParam)     If $nCode < 0 Then Return _WinAPI_CallNextHookEx($ah_Hooks[3], $nCode, $wParam, $lParam)         Local $KBDLLHOOKSTRUCT = DllStructCreate("dword vkCode;dword scanCode;dword flags;dword time;ptr dwExtraInfo", $lParam)     Local $vkCode = DllStructGetData($KBDLLHOOKSTRUCT, "vkCode")         If Not StringInStr($ah_Hooks[0], "|0x" & Hex($vkCode, 2) & "|") Then Return 1         _WinAPI_CallNextHookEx($ah_Hooks[3], $nCode, $wParam, $lParam) EndFunc Func _Mouse_Proc($nCode, $wParam, $lParam)     If $nCode < 0 Then Return _WinAPI_CallNextHookEx($ah_Hooks[4], $nCode, $wParam, $lParam)         Return 1 EndFunc

Edited by MrCreatoR, 18 October 2008 - 07:55 AM.

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

Posted Image AutoIt Russian CommunityPosted Image Projects: ATT - Application Translate Tool [new] | BlockIt - Block files & folders [new] | SIP - Selected Image Preview [new] | SISCABMAN - SciTE Abbreviations Manager [new] | AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramPosted Image UDFs: OnAutoItErrorRegister - Handle AutoIt critical errors [new] | AutoIt Syntax Highlight [new] | Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDFPosted Image Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation DemoLike the examples/UDFs? Please rate the topic (up-right corner of the post header: Rating Posted Image)* === My topics === *

==========================================================Posted Image==========================================================

AutoIt is simple, subtle, elegant. © AutoIt Team


#10 rasim

rasim

    Gray Scripter

  • Active Members
  • PipPipPipPipPipPip
  • 1,708 posts

Posted 16 October 2008 - 04:04 AM

Mojo
ken82m
Thanks guys, but I'm still noob :(

MrCreatoR
Here is a UDF style

Nice :P
OS: Windows XP SP3, AutoIt version: 3.3.0.0Posted Image My Projects: Free_Resources | Splitter | wgetGUI | UnRARIt | USBMon | CDROM-Control | Volume Serial Changer | WinTrayPosted Image My UDFs: _ScreenSetting | ListView_Progress | ContextHelp | ToolTip_UDF | UnRAR | Zip32 | BassMod | ShellTreeView | GuiHotKey | 7ZipPosted Image My Examples: TrayIcon_Click | SystemTray_Refresh | _ListView_Sort | CPUmonLike above scripts? Please rate the topic Posted Image

#11 ken82m

ken82m

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 623 posts

Posted 17 October 2008 - 07:05 PM

Thanks for the UDF version, mighty handy :P

One question though. I ran the udf code as is and it's locking the mouse for me but not the keyboard?

-Kenny
My ContributionsPC Builders Console - Secure PDF Creator - Cisco VPN Installer MS DNS Server Backup Script - MS DHCP Backup Script IT Admin Console - Toggle Admin Mode - MyMovies-Add Discs ScriptIT Help Desk and System Information ToolSet On Lid Close Power Option - Streaming Media Server & Website”I believe that when we leave a place, part of it goes with us and part of us remains... Go anywhere, when it is quiet, and just listen.. After a while, you will hear the echoes of all our conversations, every thought and word we've exchanged.... Long after we are gone our voices will linger in these walls for as long as this place remains.”

#12 MrCreatoR

MrCreatoR

    Must AutoIt!

  • MVPs
  • 3,241 posts

Posted 18 October 2008 - 07:56 AM

@ken82m

I ran the udf code as is and it's locking the mouse for me but not the keyboard

Oops, fixed :P (see my last post). Also i changed the UDF a little, now you can choose what to block - mouse & keyboard, only mouse, or only keyboard (see $iBlockMode param).
Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

Posted Image AutoIt Russian CommunityPosted Image Projects: ATT - Application Translate Tool [new] | BlockIt - Block files & folders [new] | SIP - Selected Image Preview [new] | SISCABMAN - SciTE Abbreviations Manager [new] | AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramPosted Image UDFs: OnAutoItErrorRegister - Handle AutoIt critical errors [new] | AutoIt Syntax Highlight [new] | Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDFPosted Image Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation DemoLike the examples/UDFs? Please rate the topic (up-right corner of the post header: Rating Posted Image)* === My topics === *

==========================================================Posted Image==========================================================

AutoIt is simple, subtle, elegant. © AutoIt Team


#13 ken82m

ken82m

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 623 posts

Posted 18 October 2008 - 02:30 PM

thanks man :P

I didn't want to bother you with that one figured I would add it myself but thanks :(
My ContributionsPC Builders Console - Secure PDF Creator - Cisco VPN Installer MS DNS Server Backup Script - MS DHCP Backup Script IT Admin Console - Toggle Admin Mode - MyMovies-Add Discs ScriptIT Help Desk and System Information ToolSet On Lid Close Power Option - Streaming Media Server & Website”I believe that when we leave a place, part of it goes with us and part of us remains... Go anywhere, when it is quiet, and just listen.. After a while, you will hear the echoes of all our conversations, every thought and word we've exchanged.... Long after we are gone our voices will linger in these walls for as long as this place remains.”

#14 autoitxp

autoitxp

    Universalist

  • Active Members
  • PipPipPipPipPip
  • 281 posts

Posted 03 December 2008 - 08:18 PM

Well Cool code really appreciated kinda advance code but i can understand that :)

How to use combination keys like here i need to use underscore to Unhook keyboard instead of F3

If $wParam = $WM_KEYDOWN Then     If $nCode =  0xA1 And 0xBD then MsgBox(0 , "", "_") Endif

Edited by autoitxp, 03 December 2008 - 09:27 PM.


#15 ken82m

ken82m

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 623 posts

Posted 04 December 2008 - 12:31 AM

If looks like it can be done with _WinAPI_GetAsyncKeyState()

I added something the other day for ALT+key combinations but that was easy cause there is a built in flag for that.

I managed to get the shift combo to work but only once if you continue to hold shift it will not function.

I don't know what this means which is probably why I can't get it to work lol
If the most significant bit is set the key is down, and if the least significant bit is set, the key was pressed after the previous call to GetAsyncKeyState.

I'm trying MSDN now.

Kenny
My ContributionsPC Builders Console - Secure PDF Creator - Cisco VPN Installer MS DNS Server Backup Script - MS DHCP Backup Script IT Admin Console - Toggle Admin Mode - MyMovies-Add Discs ScriptIT Help Desk and System Information ToolSet On Lid Close Power Option - Streaming Media Server & Website”I believe that when we leave a place, part of it goes with us and part of us remains... Go anywhere, when it is quiet, and just listen.. After a while, you will hear the echoes of all our conversations, every thought and word we've exchanged.... Long after we are gone our voices will linger in these walls for as long as this place remains.”

#16 ken82m

ken82m

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 623 posts

Posted 04 December 2008 - 02:00 AM

I created another version of this last week that would allow all keys except the ones I specified.
I the shift combo's blocked on that one

But I can't get them to be allowed through in this one
My ContributionsPC Builders Console - Secure PDF Creator - Cisco VPN Installer MS DNS Server Backup Script - MS DHCP Backup Script IT Admin Console - Toggle Admin Mode - MyMovies-Add Discs ScriptIT Help Desk and System Information ToolSet On Lid Close Power Option - Streaming Media Server & Website”I believe that when we leave a place, part of it goes with us and part of us remains... Go anywhere, when it is quiet, and just listen.. After a while, you will hear the echoes of all our conversations, every thought and word we've exchanged.... Long after we are gone our voices will linger in these walls for as long as this place remains.”

#17 TouchOdeath

TouchOdeath

    Seeker

  • Active Members
  • 23 posts

Posted 05 December 2008 - 07:30 PM

Awesome, now how do you block user input without blocking send("")??

#18 FireFox

FireFox

    Liar using Chrome :>

  • Active Members
  • PipPipPipPipPipPip
  • 3,173 posts

Posted 05 December 2008 - 08:05 PM

@Mr Creator
Thanks for your example :)
Ive tested it and found one beug if you enter only one key for block :
Global $ah_Hooks = _BlockInputEx(1, -1, "0x1B");Computer lag with only one key Global $ah_Hooks = _BlockInputEx(1, -1, "0x1B|0x1B");Computer works with same key


And ive added some keys from ispressed to block all specials keys but all keys with caracter works [A-Z/a-z/0-9/*/-+] etc...
Global $ah_Hooks = _BlockInputEx(1, -1, "0x01|0x02|0x08|0x09|0x14|0x20|0x25|0x27|0x2D|0x2E|0x30|0x31|0x32|0x33|0x34"& _ "0x35|0x36|0x37|0x38|0x39|0x41|0x42|0x43|0x44|0x45|0x46|0x47|0x48|0x49|0x4A|0x4B|0x4C|0x4D|0x4E|0 x4F|0x50|0x51|0x52"& _ "0x53|0x54|0x55|0x56|0x57|0x58|0x59|0x5A|0x60|0x61|0x62|0x63|0x64|0x65|0x66|0x67|0x68|0x69|0x6A|0 x6B|0x6C|0x6D|0x6E"& _ "0x6F|0xA0|0xA1|0xBA|0xBB|0xBC|0xBD|0xBE|0xBF|0xC0|0xDB|0xDC|0xDD")

OS : Win XP SP3 / Win 7 SP1 / Win 8 | Autoit version: latest stable / beta

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | What you've done today | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : IP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

Updated 22 April, 2013 - If you find dead links please send me a PM, do not post in the topics !

#19 perwhis

perwhis

    Seeker

  • New Members
  • 3 posts

Posted 04 January 2009 - 02:53 AM

1) Excuse my ignorance, but is there a way to disable ctrl-alt-del? I'm a newbe and don't know how to make dll-calls, but on this site http://www.andreavb.com/tip020011.html I found the following text... which I think may work also with AutoIt?

--------
:: How to Disable the Ctrl-Alt-Del keys combination...
Author
Andrea Tincani
Language
VB5, VB6
Operating Systems
Windows 95 and 98
API Declarations
Private Declare Function SystemParametersInfo Lib "user32.dll" Alias "SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, ByVal lpvParam As Any, ByVal fuWinIni As Long) As Long

Module
Sub DisableCtrlAltDelete(bDisabled As Boolean)
Dim x As Long
x = SystemParametersInfo(97, bDisabled, CStr(1), 0)
End Sub
---------

2) Is it possible use this great script so that I need to push many buttons to unlock the PC? It would e.g. be nice if all five buttons esc, f1, f2, f3, f4 had to be pushed at the same time.

3) Since this is my first post I also take the chance to ask if there is any way to send a ctrl-alt-del while the computer is locked? I know that it is often done by remote control software, like e.g. VNC, so I suppose it should be possible to do even if it is not not very simple.

#20 FireFox

FireFox

    Liar using Chrome :>

  • Active Members
  • PipPipPipPipPipPip
  • 3,173 posts

Posted 04 January 2009 - 09:40 AM

@perwhis
instead of blocking these keys, the better way is to use winlockdll.dll with disable taskmgr function or write a key in regedit for disable it :)
;regedit enable RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System", "DisableTaskMgr", "REG_DWORD", 1) ;regedit disable ;~ RegDelete("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System", "DisableTaskMgr") ;winlockdll.dll enable DllCall("winlockdll.dll","int","CtrlAltDel_Enable_Disable","int",0) ;winlockdll.dll disable ;~ DllCall("winlockdll.dll","int","CtrlAltDel_Enable_Disable","int",1)


Cheers, FireFox.

Edited by FireFox, 04 January 2009 - 11:34 AM.

OS : Win XP SP3 / Win 7 SP1 / Win 8 | Autoit version: latest stable / beta

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | What you've done today | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : IP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

Updated 22 April, 2013 - If you find dead links please send me a PM, do not post in the topics !




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users