Exit Posted August 13, 2014 Share Posted August 13, 2014 After searching the forum and MSDN, I believe that is it not possible to obtain the owner of a hotkey. To enhance my _Hotkey() function (see >here), I would like to show the owner of a hotkey, if Hotkeyset() fails. I believe to the power of the developers to make the impossible possible. I prepared a skeleton script to start with. Just the last function _HotkeyOwner() needs some tweaks. ;~ Hotkey checker #include <WinAPI.au3> _HotKey("{ESC}") _HotKey("{F12}") Func _HotKey($hotkey = "") Switch @HotKeyPressed Case "{ESC}" Exit MsgBox(64 + 262144, Default, "Exit", 1) Case "{F12}" Beep() Case Else If Not IsDeclared("hotkey") Then Return MsgBox(16 + 262144, Default, "No CASE statement defined for hotkey " & @HotKeyPressed) If HotKeySet($hotkey, "_Hotkey") = 0 Then Return MsgBox(16 + 262144, Default, "Hotkey " & $hotkey & " invalid or set by another application." & @LF & "Error: " & @error & " Extented: " & @extended & @LF & "Lasterror: " & _WinAPI_GetLastErrorMessage() & @LF & _HotkeyOwner($hotkey)) EndSwitch EndFunc ;==>_HotKey While Sleep(100) ; here should be your application. WEnd ; meanwhile, here is a dummy loop. Func _HotkeyOwner($hotkey) Return "No Hotkeyowner detected for hotkey " & $hotkey EndFunc ;==>_HotkeyOwner Please confirm, that there is no solution or better, ... show me the impossible. Thanks Exit App: Au3toCmd UDF: _SingleScript() Link to comment Share on other sites More sharing options...
BrewManNH Posted August 13, 2014 Share Posted August 13, 2014 Explain what you mean by the owner of a hotkey. Some so-called "hotkeys" aren't really hotkeys at all, their just windows messages that the application intercepts and processes, such as CTRL-P and CTRL-S. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
Exit Posted August 13, 2014 Author Share Posted August 13, 2014 (edited) As you already pointed out, so-called "hotkeys" aren't really hotkeys, but application accelerators. See GUISetAccelerators() in the help file. Real hotkeys are those who are set by Hotkeyset(). And only those are subject of my thread. I want to detect, which process prevents Hotkeyset() to acquire the hotkey. This might be a system process (like F12), but in most cases, it is another script or executable. And it would be a good information for the user, to know this other process. Please excuse my wording, my native language is German. But anyway, please show me the impossible. Edited August 13, 2014 by Exit App: Au3toCmd UDF: _SingleScript() Link to comment Share on other sites More sharing options...
JohnOne Posted August 13, 2014 Share Posted August 13, 2014 I don't see anywhere where you are attempting to determine this "hotkey owner" AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
BrewManNH Posted August 13, 2014 Share Posted August 13, 2014 It's not possible from everything I've read to find out what application might have a certain hotkey assigned to it. Windows doesn't give you that information. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
JohnOne Posted August 13, 2014 Share Posted August 13, 2014 There is however a list of all the hotkeys which windows uses. On the internet somewhere. cannot remember where. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Mat Posted August 13, 2014 Share Posted August 13, 2014 Well I guess if you really wanted to, you could use a global hook for all windows on the desktop, hooking their message loops to check if they are receiving a hotkey while you send it. You could even remove it from the queue so that the window didn't process it. There has to be a list somewhere in memory, though it is buried deep, and this is windows so nothing is going to be easy to find. AutoIt Project Listing Link to comment Share on other sites More sharing options...
Exit Posted August 14, 2014 Author Share Posted August 14, 2014 As I stated in my first post: "After searching the forum and MSDN, I believe that is it not possible to obtain the owner of a hotkey." , I hoped that one of you would prove me the contrary and amend the last function in my code _HotkeyOwner() . But the guru didn't turned up till now. App: Au3toCmd UDF: _SingleScript() Link to comment Share on other sites More sharing options...
Ascend4nt Posted August 14, 2014 Share Posted August 14, 2014 That's a shame that this info isn't available. I did a quick search on sysinternals and nirsoft to see if they had anything of the sort, but nothing came up. There's an old utility Ethervane ActiveHotkeys that can look to see if a hotkey is used by other programs, but it too doesn't locate what implemented it. The global Atom table sometimes is linked to the hotkeys, but that too doesn't seem to have any information on ownership. I suppose what Mat suggests could be one approach, though its quite brute-force. My contributions: 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 UDFs | Process 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) Link to comment Share on other sites More sharing options...
Exit Posted August 15, 2014 Author Share Posted August 15, 2014 I searched the atom-table with the atom-table-monitor , but no luck. I found no entries pertaining to the hotkeys, App: Au3toCmd UDF: _SingleScript() Link to comment Share on other sites More sharing options...
BrewManNH Posted August 15, 2014 Share Posted August 15, 2014 Why do you need/want to know the "owner" of a certain hotkey? Just because you want to know, or is there a real reason for knowing it? If you're creating hotkeys, you're overwriting the ones that already exist anyways, and you can't reassign them once you're done. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
Exit Posted August 15, 2014 Author Share Posted August 15, 2014 Why do you need/want to know the "owner" of a certain hotkey? Just because you want to know, or is there a real reason for knowing it? If you're creating hotkeys, you're overwriting the ones that already exist anyways, and you can't reassign them once you're done. "If you're creating hotkeys, you're overwriting the ones that already exist." Partially wrong! You can overwrite them, if you created them. If they where created by another process, your creation fails. And when the creation fails, I want to inform the user, which process is involved. Then he can close this process and try again. Btw, I pointed this out in post #1 and #3. "anyways, and you can't reassign them once you're done". Also wrong! You can reassign them, if you created them. But ,perhaps another user has the inspiration. App: Au3toCmd UDF: _SingleScript() Link to comment Share on other sites More sharing options...
KaFu Posted August 17, 2014 Share Posted August 17, 2014 This is the closest I could find, though it seems to utilize ASM and driver stuff ... http://www.wasm.ru/wault/article/show/gui_subsystem 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) Link to comment Share on other sites More sharing options...
Exit Posted August 17, 2014 Author Share Posted August 17, 2014 Я не говорю по-русски App: Au3toCmd UDF: _SingleScript() Link to comment Share on other sites More sharing options...
BrewManNH Posted August 17, 2014 Share Posted August 17, 2014 Google, or Bing translate the page, Bing did a far better job when I translated it than Google did. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
Ascend4nt Posted August 18, 2014 Share Posted August 18, 2014 That russian page discusses device-level kernel operations, which is a little insane. And who knows what the 64-bit equivalent code would be and if that stuff is even portable to other O/S versions. I also found another page where someone tried to tackle the same problem, but it all winds up being guesswork in the end.. My contributions: 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 UDFs | Process 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) Link to comment Share on other sites More sharing options...
Richard Robertson Posted August 19, 2014 Share Posted August 19, 2014 It sounds like the only reliable method is actually hooking window messages, simulating the key press, and removing the message from a queue when you catch it. Not even sure if you can do that in only AutoIt. Link to comment Share on other sites More sharing options...
trancexx Posted August 19, 2014 Share Posted August 19, 2014 You need dll for that, so no. ♡♡♡ . eMyvnE 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