MrCreatoR Posted February 5, 2007 Share Posted February 5, 2007 Why when i using BlockInput(1), not just Ctrl+Alt+Del is able to turn off this func, also when i press “Power” key, or “Sleep” key, the BlockInput is disabled and the computer go to sleep ?Maby there is a way to block this hotkeys? or better, how to use BlockInput that only the Ctrl+Alt+Del will disable the block? (like BlockInput(0) )And i have another question - It is possible to check, if the BlockInput is enabled? i have tried like this:BlockInput(1) $Ret = _IsBlocked() MsgBox(0, "", $Ret, 5) BlockInput(0) Func _IsBlocked() Dim $Return = 1 HotKeySet("{ALT}", "AltTest") Send("{ALT}") HotKeySet("{ALT}") Return $Return EndFunc Func AltTest() Global $Return = 0 EndFuncBut always returned 1. I dont understand, while BlockInput is enabled, the Alt key can not be sent, therefore, if i send Alt key while the blockinput is Disabled, it should execute the func that set $Return to 0 ( AltTest() ), but it not happened, why? Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler 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 ProgramUDFs: 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 UDF 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 Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
gnosis3d Posted February 5, 2007 Share Posted February 5, 2007 (edited) I just used BlockInput and it worked fine (it was for testing in my script). Perhaps the usage of ALT as a hotkey itself, since ALT is a "shifting" key instead of an actual value is an issue? Or that you are doing a Dim in one function and a Global in another for the same value. Overwriting the values... could be defaulting to one all the time. Edited February 5, 2007 by gnosis3d Link to comment Share on other sites More sharing options...
MrCreatoR Posted February 6, 2007 Author Share Posted February 6, 2007 From the Help File: If BlockInput is enabled, the Alt keypress cannot be sent! It is not correct, see this example: BlockInput(1) $Ret = _IsBlocked() MsgBox(0, "", $Ret, 3) BlockInput(0) Func _IsBlocked() Global $Return = 1 HotKeySet("!o", "AltTest") Send("!{o}") Return $Return EndFunc Func AltTest() Global $Return = 0 EndFunc Returned 0, couse the function AltTest is executed, how it can be possible if the alt key can not be sent? Somebody - how can i check if the BlockInput is enabled or disabled? - and also, how to set this function, that just Cll+Alt+Del will stop (disable) this function? Thanx! Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler 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 ProgramUDFs: 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 UDF 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 Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
MHz Posted February 7, 2007 Share Posted February 7, 2007 Returned 0, couse the function AltTest is executed, how it can be possible if the alt key can not be sent?Look further down the page with the remarks of BlockInput().If you are using Windows XP then you should be aware that a hotfix released inbetween SP1 and SP2 limited Blockinput so that the ALT key could NOT be sent. This is fixed in XP SP2.So I guess your not using Windows XP SP1 with the hotfix that caused the ALT key change of behaviour?As for the power or sleep keys, a standard 102 button keyboard does not have them so it is extra buttons added by the manufacturer of the device. Link to comment Share on other sites More sharing options...
MrCreatoR Posted February 7, 2007 Author Share Posted February 7, 2007 Look further down the page with the remarks of BlockInput().Oops :"> sorry, i didn't see this, and yes, i have an SP2 on my Windows.As for the power or sleep keys, a standard 102 button keyboard does not have them so it is extra buttons added by the manufacturer of the device.Ok, thanx. But, in the case that i have more than 102 buttons in my keyboard (moust keyboards of today have more then 102 buttons ), how can i disable them using AutoIt? (while or before execute the func BlockInput).Why i need this? well, i have write a very big script, that help me to clean my mouse and keyboard (using BlockInput), but by accident when i clean the keyboard, i press the “Power” button, and the computer was shutdown.And i just like to know how to block all inputs except the Ctrl+Alt+Del - It is possible? Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler 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 ProgramUDFs: 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 UDF 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 Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
MrCreatoR Posted February 28, 2007 Author Share Posted February 28, 2007 Any one?I just need a way to block all keys except Ctrl Alt Del Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler 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 ProgramUDFs: 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 UDF 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 Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
HardHackz Posted February 28, 2007 Share Posted February 28, 2007 Any one?I just need a way to block all keys except Ctrl Alt Del I'm looking for a similair thing, I don't want Ctrl + Alt + Del to do it. But I want a different key to unblock it. The problem is the hotkeys won't work because they keyboard is blocked. [center]My BlogOldSock Programs (AutoIT Apps)A Message to Hackers! (NOT SKIDDIES!)OldSock Programs is my little "company."[/center] Link to comment Share on other sites More sharing options...
i386 Posted February 28, 2007 Share Posted February 28, 2007 I believe the easiest way to do this is to search nonags.com or some other download site that has software that is written in another language that talks more in machine language. Since the language is a little more advanced than AutoIt, then it should do the trick. Or, you could just shut the computer down or unplug the devices during the cleaning process. Spoiler "...Yes, I am a criminal. My crime is that of curiosity. My crime is that of judging people by what they say and think, not what they look like.My crime is that of outsmarting you, something that you will never forgive me for." --The Mentor "Mess with the best, die like the rest!!" -Hackers "This above all to thine own self be true." -William Shakespeare "Corruption is only as corrupted as the individual makes it out to be." -i386 Link to comment Share on other sites More sharing options...
MrCreatoR Posted November 24, 2007 Author Share Posted November 24, 2007 (edited) Almoust year after , maybe someone have an idea how to block extra buttons on the keyboard? P.SI need it for my KeyBoard & Mouse Cleaner project . Edited November 24, 2007 by MsCreatoR Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler 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 ProgramUDFs: 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 UDF 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 Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
Oldschool Posted November 24, 2007 Share Posted November 24, 2007 There you go...http://www.autoitscript.com/forum/index.ph...c=21427&hl= Link to comment Share on other sites More sharing options...
MrCreatoR Posted November 25, 2007 Author Share Posted November 25, 2007 There you go...Thanks, but it not lock out the Power/Sleep keys Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler 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 ProgramUDFs: 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 UDF 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 Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
Oldschool Posted November 25, 2007 Share Posted November 25, 2007 (edited) Thanks, but it not lock out the Power/Sleep keys Well what exactly happens at boot time?If you boot without the keyboard plugged in, and then plug it in later, it does not work.Try to disrupt the Device manager somehow to mimic that effect. Edited November 25, 2007 by Oldschool Link to comment Share on other sites More sharing options...
MrCreatoR Posted November 25, 2007 Author Share Posted November 25, 2007 (edited) Thanks for the idea, i think if there will be a way to unplug/plug the keyboard device (programly), then my problem is solved... Maybe someone know how to do this? Edited November 25, 2007 by MsCreatoR Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler 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 ProgramUDFs: 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 UDF 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 Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
MrCreatoR Posted November 26, 2007 Author Share Posted November 26, 2007 Ok, here is a solution (by amel27 ) ...expandcollapse popup;Example for using with DllCallBack.au3 library (for AutoIt v3.8.2.1 and lower) #include <DllCallBack.au3> Global $hWinHook $CallBackProc = TogglePlugKeyBoard() MsgBox(4096, "", "KeyBoard is disabled, press OK to enable it :).") TogglePlugKeyBoard($CallBackProc) MsgBox(4096, "", "KeyBoard is enabled!") Exit Func TogglePlugKeyBoard($hCallProc=0) If IsArray($hWinHook) Then DllCall("user32.dll", "int", "UnhookWindowsHookEx", "hwnd", $hWinHook[0]) _DllCallBack_Free($hCallProc) Return 0 EndIf Local Const $WH_KEYBOARD_LL = 13 Local $hKeyProc = _DllCallBack("_KeyProc", "int;ptr;ptr") Local $hMod = DllCall("kernel32.dll", "hwnd", "GetModuleHandle", "ptr", 0) $hWinHook = DllCall("user32.dll", "hwnd", "SetWindowsHookEx", _ "int", $WH_KEYBOARD_LL, _ "ptr", $hKeyProc, _ "hwnd", $hMod[0], _ "dword", 0) Return $hKeyProc EndFunc Func _KeyProc($nCode, $wParam, $lParam) If $nCode < 0 Then Local $iRet = DllCall("user32.dll", "long", "CallNextHookEx", "hwnd", $hWinHook[0], _ "int", $nCode, _ "ptr", $wParam, _ "ptr", $lParam) Return $iRet[0] EndIf Return 1 EndFunc ;============================================= ;Example only for AutoIt v3.2.10.0 and higher: Global $hWinHook $CallBackProc = TogglePlugKeyBoard() MsgBox(4096, "", "KeyBoard is disabled, press OK to enable it :).") TogglePlugKeyBoard($CallBackProc) MsgBox(4096, "", "KeyBoard is enabled!") Exit Func TogglePlugKeyBoard($hCallProc=0) If IsArray($hWinHook) Then DllCall("user32.dll", "int", "UnhookWindowsHookEx", "hwnd", $hWinHook[0]) DllCallbackFree($hCallProc) Return 0 EndIf Local Const $WH_KEYBOARD_LL = 13 Local $hKeyProc = DllCallbackRegister("_KeyProc", "int", "int;ptr;ptr") Local $hMod = DllCall("kernel32.dll", "hwnd", "GetModuleHandle", "ptr", 0) $hWinHook = DllCall("user32.dll", "hwnd", "SetWindowsHookEx", _ "int", $WH_KEYBOARD_LL, _ "ptr", DllCallbackGetPtr($hKeyProc), _ "hwnd", $hMod[0], _ "dword", 0) Return $hKeyProc EndFunc Func _KeyProc($nCode, $wParam, $lParam) If $nCode < 0 Then Local $iRet = DllCall("user32.dll", "long", "CallNextHookEx", "hwnd", $hWinHook[0], _ "int", $nCode, _ "ptr", $wParam, _ "ptr", $lParam) Return $iRet[0] EndIf Return 1 EndFunc Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler 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 ProgramUDFs: 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 UDF 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 Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
Generator Posted November 26, 2007 Share Posted November 26, 2007 (edited) Ok, here is a solution (by amel27 ) ... expandcollapse popup;Example for using with DllCallBack.au3 library (for AutoIt v3.8.2.1 and lower) #include <DllCallBack.au3> Global $hWinHook $CallBackProc = TogglePlugKeyBoard() MsgBox(4096, "", "KeyBoard is disabled, press OK to enable it :).") TogglePlugKeyBoard($CallBackProc) MsgBox(4096, "", "KeyBoard is enabled!") Exit Func TogglePlugKeyBoard($hCallProc=0) If IsArray($hWinHook) Then DllCall("user32.dll", "int", "UnhookWindowsHookEx", "hwnd", $hWinHook[0]) _DllCallBack_Free($hCallProc) Return 0 EndIf Local Const $WH_KEYBOARD_LL = 13 Local $hKeyProc = _DllCallBack("_KeyProc", "int;ptr;ptr") Local $hMod = DllCall("kernel32.dll", "hwnd", "GetModuleHandle", "ptr", 0) $hWinHook = DllCall("user32.dll", "hwnd", "SetWindowsHookEx", _ "int", $WH_KEYBOARD_LL, _ "ptr", $hKeyProc, _ "hwnd", $hMod[0], _ "dword", 0) Return $hKeyProc EndFunc Func _KeyProc($nCode, $wParam, $lParam) If $nCode < 0 Then Local $iRet = DllCall("user32.dll", "long", "CallNextHookEx", "hwnd", $hWinHook[0], _ "int", $nCode, _ "ptr", $wParam, _ "ptr", $lParam) Return $iRet[0] EndIf Return 1 EndFunc ;============================================= ;Example only for AutoIt v3.2.10.0 and higher: Global $hWinHook $CallBackProc = TogglePlugKeyBoard() MsgBox(4096, "", "KeyBoard is disabled, press OK to enable it :).") TogglePlugKeyBoard($CallBackProc) MsgBox(4096, "", "KeyBoard is enabled!") Exit Func TogglePlugKeyBoard($hCallProc=0) If IsArray($hWinHook) Then DllCall("user32.dll", "int", "UnhookWindowsHookEx", "hwnd", $hWinHook[0]) DllCallbackFree($hCallProc) Return 0 EndIf Local Const $WH_KEYBOARD_LL = 13 Local $hKeyProc = DllCallbackRegister("_KeyProc", "int", "int;ptr;ptr") Local $hMod = DllCall("kernel32.dll", "hwnd", "GetModuleHandle", "ptr", 0) $hWinHook = DllCall("user32.dll", "hwnd", "SetWindowsHookEx", _ "int", $WH_KEYBOARD_LL, _ "ptr", DllCallbackGetPtr($hKeyProc), _ "hwnd", $hMod[0], _ "dword", 0) Return $hKeyProc EndFunc Func _KeyProc($nCode, $wParam, $lParam) If $nCode < 0 Then Local $iRet = DllCall("user32.dll", "long", "CallNextHookEx", "hwnd", $hWinHook[0], _ "int", $nCode, _ "ptr", $wParam, _ "ptr", $lParam) Return $iRet[0] EndIf Return 1 EndFunc Edited November 26, 2007 by Generator Link to comment Share on other sites More sharing options...
Oldschool Posted November 28, 2007 Share Posted November 28, 2007 This is really useful Niiiiiiiceeeeeeeeeeeee Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now