iHonda Posted January 17, 2009 Share Posted January 17, 2009 I searched the forum for this as well as the help file. and i also know that a hotkey would disable the keys however I need to do it only while a GUI is active so setting a hotkey wouldnt work because you cant unset a hotkey at least not that I can tell. any help would be welcome. Peace, iHonda A great place to start Autoit 1-2-3 Link to comment Share on other sites More sharing options...
NerdFencer Posted January 17, 2009 Share Posted January 17, 2009 Here is how... ;Disable RegWrite("HKEY_CURRENT_USER\Control Panel\Desktop","CoolSwitch","REG_SZ",0) ;Enable RegWrite("HKEY_CURRENT_USER\Control Panel\Desktop","CoolSwitch","REG_SZ",1) _________[u]UDFs[/u]_________-Mouse UDF-Math UDF-Misc Constants-Uninstaller Shell Link to comment Share on other sites More sharing options...
ResNullius Posted January 17, 2009 Share Posted January 17, 2009 I searched the forum for this as well as the help file. and i also know that a hotkey would disable the keys however I need to do it only while a GUI is active so setting a hotkey wouldnt work because you cant unset a hotkey at least not that I can tell. any help would be welcome. Peace, iHondaTo "unset" a hotkey, call HotKeySet() without passing a function name: #include <GuiConstantsEx.au3> $test = GUICreate("test") $btnDisable = GUICtrlCreateButton("Disable ALT-TAB", 50, 50) $btnEnable = GUICtrlCreateButton("Enable ALT-TAB", 50, 150) GUICtrlSetState(-1, $GUI_DISABLE) GUISetState() While 1 Switch GUIGetMsg() Case - 3 Exit Case $btnDisable HotKeySet("!{TAB}", "_DoNothing") GUICtrlSetState($btnEnable, $GUI_ENABLE) GUICtrlSetState($btnDisable, $GUI_DISABLE) Case $btnEnable HotKeySet("!{TAB}") GUICtrlSetState($btnDisable, $GUI_ENABLE) GUICtrlSetState($btnEnable, $GUI_DISABLE) EndSwitch WEnd Func _DoNothing() Return EndFunc Link to comment Share on other sites More sharing options...
FireFox Posted January 17, 2009 Share Posted January 17, 2009 @NerdFencer Thanks for your example with the registry Cheers, FireFox. Link to comment Share on other sites More sharing options...
iHonda Posted January 17, 2009 Author Share Posted January 17, 2009 @NerdFencer thanks for the input but on some machines that requires a restart to take effect @ResNullius Thanks for the info i didnt know it would work that way. A great place to start Autoit 1-2-3 Link to comment Share on other sites More sharing options...
rasim Posted January 18, 2009 Share Posted January 18, 2009 (edited) @NerdFencerYour method does not work for me.@ResNulliusGood old and easy method. But does not work in the any full-screen game. This is my solution:expandcollapse popup#include <WinAPI.au3> #include <WindowsConstants.au3> #include <StructureConstants.au3> HotKeySet("{Pause}", "_Exit") Global Const $VK_TAB = 0x09 $hHookProc = DllCallbackRegister("_KeyboardProc", "long", "int;wparam;lparam") $hHookKeyboard = _WinAPI_SetWindowsHookEx($WH_KEYBOARD_LL, DllCallbackGetPtr($hHookProc), _WinAPI_GetModuleHandle(0), 0) While 1 Sleep(100) WEnd Func _KeyboardProc($nCode, $wParam, $lParam) If $nCode < 0 Then Return _WinAPI_CallNextHookEx($hHookKeyboard, $nCode, $wParam, $lParam) Switch $wParam Case $WM_KEYDOWN, $WM_SYSKEYDOWN, $WM_KEYUP, $WM_SYSKEYUP Local $tKEYHOOKS = DllStructCreate($tagKBDLLHOOKSTRUCT, $lParam) Local $vKode = DllStructGetData($tKEYHOOKS, "vkCode") Local $iFlags = DllStructGetData($tKEYHOOKS, "flags") Switch $vKode Case $VK_TAB If BitAND($iFlags, $LLKHF_ALTDOWN) Then Return -1 Else Return _WinAPI_CallNextHookEx($hHookKeyboard, $nCode, $wParam, $lParam) EndIf EndSwitch EndSwitch Return _WinAPI_CallNextHookEx($hHookKeyboard, $nCode, $wParam, $lParam) EndFunc ;==>_KeyboardProc Func _Exit() DllCallbackFree($hHookProc) _WinAPI_UnhookWindowsHookEx($hHookKeyboard) Exit EndFuncLooks not easy, but works correct Edit: grammar spelling. Edited January 18, 2009 by rasim Link to comment Share on other sites More sharing options...
FireFox Posted January 18, 2009 Share Posted January 18, 2009 @rasim can be done easier with BlockInputEx udf Cheers, FireFox. 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