MoRBiDuS Posted May 5, 2010 Posted May 5, 2010 You can specify a hot key for CTRL-ALT-DEL but not block it. This is impossible in Windows NT-based systems (I think). Moreover there are no good reasons to do so. Block Crtl+Alt+Delete [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\taskmgr.exe] "Debugger"="Hotkey Disabled"
Shafayat Posted May 5, 2010 Posted May 5, 2010 (edited) That's not really blocking. It's asking not to run. There is a difference. Where blocking would be not letting windows take action on ctrl+alt+del by providing a veto as done to other "blockable" key combinations. This registry editing method still lets windows initiate a process to run taskmgr.exe which check either the registry value tells it to run or not. So, this is not blocking and essentially not reliable as it is not practical to keep checking whether the value of registry has been changed or not as other programs or the user might set it to On. Edited May 5, 2010 by Shafayat [Not using this account any more. Using "iShafayet" instead]
Shafayat Posted May 11, 2010 Posted May 11, 2010 The opt('onexitfunc'.... Has been removed. Search the autoit help file for details. [Not using this account any more. Using "iShafayet" instead]
m4tius Posted May 11, 2010 Posted May 11, 2010 (edited) Thx, I guess I fixed it: Global $OnHotKeyExit = Opt(OnAutoItExitRegister('OnHotKeyExit')) After this example scripts from the first post work well but I wanted to check another simple script and it doesnt work. #Include <HotKey.au3> Global Const $VK_F12 = 0x7B _HotKeyAssign($VK_F12, 'Set') While 1 Sleep(10) WEnd Func Set() send("a") EndFunc I really dont know wtf? ;/ Edited May 11, 2010 by m4tius
KaFu Posted May 11, 2010 Posted May 11, 2010 (edited) Thx, I guess I fixed it: Global $OnHotKeyExit = Opt(OnAutoItExitRegister('OnHotKeyExit')) Should be OnAutoItExitRegister("OnHotKeyExit") and delete the call to $OnHotKeyExit in the function "OnHotKeyExit" itself. After this example scripts from the first post work well but I wanted to check another simple script and it doesnt work. #Include <HotKey.au3> Global Const $VK_F12 = 0x7B _HotKeyAssign($VK_F12, 'Set') While 1 Sleep(10) WEnd Func Set() send("a") EndFunc I really dont know wtf? ;/ Beats me, add a consolewrite("a" & @crlf) to the set function and you'll see that it IS called, but send doesn't seem to work.... Edit: This works... Func Set() ConsoleWrite("a" & @crlf) ControlSend("","","","a") EndFunc Edited May 11, 2010 by KaFu OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2024-Oct-20) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16)
m4tius Posted May 12, 2010 Posted May 12, 2010 (edited) I was just changing the numbers in $VK_F12 of previous script and shift, alt, ctrl and winkey didnt work for me... The rest was ok. Func Set() ControlSend("","","","a") EndFunc ^ works without ConsoleWrite Edited May 12, 2010 by m4tius
Gar Posted May 19, 2010 Posted May 19, 2010 (edited) Unfortunate problem with this UDF... using these hotkeys causes pauses in the program's reading of my input. This includes mouse movement and keyboard controls. Though mouse clicks seem fine. Anyone have any idea how to fix this? Just found out that NOBLOCKHOTKEY flag prevents this problem... unfortunately that's a silly workaround. Any ideas? Edited May 19, 2010 by Gar
Yashied Posted May 19, 2010 Author Posted May 19, 2010 Unfortunate problem with this UDF... using these hotkeys causes pauses in the program's reading of my input. This includes mouse movement and keyboard controls. Though mouse clicks seem fine. Anyone have any idea how to fix this?Just found out that NOBLOCKHOTKEY flag prevents this problem... unfortunately that's a silly workaround. Any ideas?Where your code? My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More...
Gar Posted May 19, 2010 Posted May 19, 2010 (edited) _HotKeyAssign($VK_F2, 'MyFunction', $HK_FLAG_DEFAULT, $hWND) Func MyFunction() EndFunc I was able to reduce it to just this and it still caused the blocked input... I believe this program checks physical key states for its input, too, if that matters. Edited May 19, 2010 by Gar
intime69 Posted February 9, 2011 Posted February 9, 2011 (edited) Under Windows 7 (64 bit), assigning Win+L to a HotKey doesn't replace Win+L. Both the HotKey func and the Win+L key are executed. It therefore seems like Win+L can't be disabled as is the case with Ctrl+Alt+Del. Does anybody know if there is a workaround for this? Can Win+L be completely replaced using HotKey or any other method?Here's a quick example showing this:#Include <HotKey.au3> #Include 'vkConstants.au3' HotKeySet('{Esc}', '_Quit') _HotKeyAssign(BitOR($CK_WIN, $VK_L), 'ReplaceWinLock') While 1 Sleep(10) WEnd Func ReplaceWinLock() MsgBox (0, "Win+L Pressed", "Lock Station (Win+L) still executed and so did the 'ReplaceWinLock' function which displayed this dialog.") EndFunc ;==>ReplaceWinLock Func _Quit() Exit EndFunc ;==>_QuitI've been trying to find a solution to this problem for several days now without success...Any help would be greatly appreciated,IanP.S.: Please note that the same problem occurs when using the following UDF's: _LimitInputEx.au3, _BlockInputEx.au3. Blocking Win+L is not possible even if the WinKey is disabled. Disabling the LockWorkStation feature using the following registry fix [link] doesn't help since the Win+L key combination is still executed even though the LockWorkStation screen does not appear. Pressing Win+L actually re-enables other WinKey combinations such as Win+R, Win+M, Win+D, etc. even though the WinKey is still disabled. Furthermore, the WinKey remains pressed following a Win+L key combination. Pressing 'R' on it's own will therefore execute the 'Run' dialog. I will most likely post the above in the _LimitInputEx.au3 or _BlockInputEx.au3 topics if no solution is found here. Edited February 9, 2011 by intime69 Developer and Co-OwnerInTime Applicaitons Inc.
qwert Posted February 10, 2011 Posted February 10, 2011 I've been working with HotKey.au3 for a couple days now ... and am getting strange results. Yet, the UDF seems to be just what I need. I've attached a simplified version of what I'm trying. I open WordPad and try to insert characters ... with very limited success. Plus, there's something I'm confused about in the first post, which includes this comment: You can specify a hot key, any key, including the CTRL-ALT-DEL, F12, WIN-..., etcBut when I've tried to use the RWIN key, I get no result ... and it seems to affect Windows to the point that I had to reboot to restore full keyboard functionality after exiting my test script. I've tried to model after the examples, so I don't see where it's missing anything. Another strange result is that only the Carat() function ever executes ... never the Amper(). My goal is simply to have the APPSKEY send one of two different characters (depending on the shift state). Having access to the RWIN key would be icing on the cake. expandcollapse popup#Include <HotKey.au3> Global Const $VK_ESCAPE = 0x1B Global Const $VK_RWIN = 0x5C Global Const $VK_APPS = 0x5D Global Const $VK_SHIFT = 0x10 $ex = Chr(120) ; Assign "CTRL-ESC" with Quit() ... and the other keys _HotKeyAssign(BitOR($CK_CONTROL, $VK_ESCAPE), 'Quit') ; this works ... all the time _HotKeyAssign($VK_APPS, "Amper") ; this works ... some of the time _HotKeyAssign(BitOr($CK_CONTROL, $VK_APPS), "Carat") ; this works ... most of the time _HotKeyAssign(BitOr($VK_SHIFT, $VK_APPS), "Carat") ; this doesn't work <<<<<<< _HotKeyAssign($VK_RWIN, "Exes") ; this doesn't work <<<<<<< _HotKeyEnable() ; is this needed? While 1 Sleep(10) WEnd ;------------------------------------------------------------------------------------ Func Amper() MsgBox(0, 'AppKey', '... has been pressed!', 2) Send("{ASC 38}") EndFunc Func Carat() MsgBox(0, 'Shift Apps', '... has been pressed!',2) Send("{ASC 94}") EndFunc Func Exes() MsgBox(0, 'Exes', '... has been pressed!',2) Send("{" & $ex & " 3}") EndFunc Func Quit() MsgBox(0, 'Ctrl-Esc', '... has been pressed!',2) _HotKeyDisable() ; is this needed? Exit EndFunc ;==>Quit If someone who's successfully used this UDF could take a look at this, I could certainly use some help. Thanks in advance. BTW, the only change I've made to v1.6 was to implement the OnAutoitExitRegister("OnHotkeyExit") fix.
Yashied Posted February 10, 2011 Author Posted February 10, 2011 (edited) You can not assign only CK keys (not combining them with VK keys). You can assign CTRL+ALT+DEL and WIN+L, but Windows will not let you block them. Edited February 10, 2011 by Yashied My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More...
qwert Posted February 10, 2011 Posted February 10, 2011 Yashied, thank you for responding. I think I understand you in that Windows will always process the RWIN key, so it's not practical to use it. But the other part about CK, I don't quite follow. Which of these three Hotkey assignments are OK: _HotKeyAssign($VK_APPS, "Amper") _HotKeyAssign(BitOr($CK_CONTROL, $VK_APPS), "Carat") _HotKeyAssign(BitOr($VK_SHIFT, $VK_APPS), "Carat")Is it only the VK_SHIFT and VK_APPS combination that won't work? Also, is there anything special I need to do to cause Windows to ignore the key that I've used? Or is that all handled by HotKey.au3? And I was uncertain whether I need to do any clean up when my script exits. Or is that also handled by HotKey.au3? Sorry for these basic questions, but I'm trying to get this right. I appreciate your help.
Yashied Posted February 10, 2011 Author Posted February 10, 2011 (edited) _HotKeyAssign($VK_APPS, "Amper") - OK_HotKeyAssign(BitOr($CK_CONTROL, $VK_APPS), "Carat") - OK_HotKeyAssign(BitOr($VK_SHIFT, $VK_APPS), "Carat") - Invalid combinationReplace to_HotKeyAssign(BitOr($CK_SHIFT, $VK_APPS), "Carat")Do not use the following values.VK_SHIFTVK_CONTROLVK_MENUVK_LWINVK_RWINVK_LSHIFTVK_RSHIFTVK_LCONTROLVK_RCONTROLVK_LMENUVK_RMENU Edited February 10, 2011 by Yashied My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More...
intime69 Posted March 5, 2011 Posted March 5, 2011 _HotKeyAssign($VK_APPS, "Amper") - OK_HotKeyAssign(BitOr($CK_CONTROL, $VK_APPS), "Carat") - OK_HotKeyAssign(BitOr($VK_SHIFT, $VK_APPS), "Carat") - Invalid combinationReplace to_HotKeyAssign(BitOr($CK_SHIFT, $VK_APPS), "Carat")Do not use the following values.VK_SHIFTVK_CONTROLVK_MENUVK_LWINVK_RWINVK_LSHIFTVK_RSHIFTVK_LCONTROLVK_RCONTROLVK_LMENUVK_RMENUYashied, so does this mean that there is no way to assign a hot key to the WinKey. I simply want to display a message if the WinKey is pressed (which usually shows the Start Menu). Is this possible? Developer and Co-OwnerInTime Applicaitons Inc.
KaFu Posted March 5, 2011 Posted March 5, 2011 Yes it is, just use the values as defined in the script itself: Global Const $CK_SHIFT = 0x0100 Global Const $CK_CONTROL = 0x0200 Global Const $CK_ALT = 0x0400 Global Const $CK_WIN = 0x0800 OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2024-Oct-20) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16)
intime69 Posted March 5, 2011 Posted March 5, 2011 Yes it is, just use the values as defined in the script itself: Global Const $CK_SHIFT = 0x0100 Global Const $CK_CONTROL = 0x0200 Global Const $CK_ALT = 0x0400 Global Const $CK_WIN = 0x0800 I tried it a few times and it doesn't seem to work. Furthermore, those global constants are already defined in the UDF. Here's my code: _HotKeyAssign($CK_WIN, 'Message') ... but it doesn't do nothing. Am I assigning this the wrong way? Ian Developer and Co-OwnerInTime Applicaitons Inc.
KaFu Posted March 5, 2011 Posted March 5, 2011 (edited) Yep, see doc for _HotKeyAssign(): ; The combination of keys can be composed of one function key (VK) and some system keys (CK). This code can not consist ; only of the system keys. To combine system keys with the function key use BitOR(). See following examples. ; (VK-constants are used in the vkConstants.au3) #Include <HotKey_v1.6.au3> Global Const $VK_ESCAPE = 0x1B Global Const $VK_M = 0x4D ; Assign "WIN+M" with Message() and set extended function call _HotKeyAssign(BitOR($CK_WIN,$VK_M), 'Message', BitOR($HK_FLAG_DEFAULT, $HK_FLAG_EXTENDEDCALL)) ; Assign "ESC" with Quit() _HotKeyAssign($VK_ESCAPE, 'Quit') While 1 Sleep(10) WEnd Func Message($iKey) MsgBox(0, 'Hot key Test Message', 'WIN+M (0x' & Hex($iKey, 4) & ') has been pressed!') EndFunc ;==>Message Func Quit() Exit EndFunc ;==>Quit Edited March 5, 2011 by KaFu OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2024-Oct-20) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16)
intime69 Posted March 6, 2011 Posted March 6, 2011 Yep, see doc for _HotKeyAssign(): Okay, so setting the WinKey on it's own doesn't work... I guess I should use _isPressed instead! Oh well! Thanks for taking the time to code up an alternative example. I really appreciate it! Ian Developer and Co-OwnerInTime Applicaitons Inc.
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