105
43
Given a hotkey, how can I find which program owns it?
105
43
Given a hotkey, how can I find which program owns it?
47
Caution: If you use Win 8 or later, do not use this utility as it will create some trouble - see comments.
If you are running a Windows earlier than Windows 8, then Windows Hotkey Explorer is probably what you want. This is also mentioned in the StackOverflow question: Find out what process registered a global hotkey? (Windows API).
If Hotkey Explorer reports hotkey as explorer.exe (TaskBar) then probably one of icons on desktop has this hotkey set in its properties. – Piotr Dobrogost – 2014-09-10T16:20:28.740
32HotKey explorer screws up pretty badly in Windows 8 - on startup it basically "presses" every hotkey, causing all kinds of weird stuff to happen, after which it locks up and has to be killed. – Nathan Ridley – 2015-01-18T19:19:51.583
1Great, @Piotr. But I wanted to find out which desktop icon owned a hotkey. (BTW, hotkey === shortcut key, right?) – Bob Stein – 2015-02-06T22:09:31.310
2@NathanRidley Ugh. I wish I read your comment before. This was a horrible combination with Win8 and Autohotkey. This kind of keyboard bashing could have done some serious damage too. – VitalyB – 2015-08-09T07:25:32.300
11Do NOT use Hotkey Explorer on Windows 10 either. It does the same thing @NathanRidley mentioned. Just found out the hard way. – Artem Russakovskii – 2015-08-11T16:35:47.873
5Also pretty screwy on Windows 7. It switched my main monitor's resolution to 640x480 (multi monitor set up). – Costa – 2015-08-29T16:08:35.480
3I wish there was a more recent tool like Hotkey Exporer that works for Windows 8 & 10 – Flion – 2016-01-16T17:09:45.203
1 @Flion: so do I. I have started a thread over at SwRec: How to list all current Windows Hotkeys?
1@Costa works great for me on Win 7 x64 – Gene Pavlovsky – 2016-10-12T15:31:57.893
2Year 2016 is now. Answers for old versions of Windows either should be obsolete, or not be redirected to here. – Dims – 2016-11-29T15:04:09.337
Windows 7 x64. Program try press all hotkeys and hangs. – Enyby – 2017-10-19T03:53:32.620
Why an answer remains as the accepted one if it's clearly causing trouble and it's not reccommended by those who test it? It just doesn't feels right... – Metafaniel – 2018-04-27T18:09:53.490
exactly! in fact, the spy++ answer below works for even older versions of windows (it works at least as far back as windows XP) – éclairevoyant – 2018-05-18T22:59:19.123
66
This works for me in Win10 (and probably all other even vaguely-recent versions of Windows)... also copied here from https://stackoverflow.com/a/43645062/995048 since this page seems to come up first in search results:
One possible way is to use the Visual Studio tool Spy++.
Give this a try:
- Run the tool (for me, it's at
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\Tools\spyxx_amd64.exe, or usespyxx.exeto monitor 32-bit processes)- In the menu bar, select Spy -> Log messages... (or hit Ctrl + M)
- Check All Windows in System in the Additional Windows frame
- Switch to the Messages tab
- Click the Clear All button
- Select
WM_HOTKEYin the listbox, or check Keyboard in Message Groups (if you're OK with more potential noise)- Click the OK button
- Press the hotkey in question (Win + R, for example)
- Select the
WM_HOTKEYline in the Messages (All Windows) window, right click, and select Properties... in the context menu- In the Message Properties dialog, click the Window Handle link (this will be the handle for the window that received the message)
- Click the Synchronize button on the Window Properties dialog. This will show the window in the main Spy++ window treeview.
- On the Window Properties dialog, select the Process tab
- Click the Process ID link. This will show you the process (In my Win + R case:
EXPLORER)
3This is a great answer, it is a lot of steps but gives perfectly detailed information. Note that you will need to install SPY++ somehow and that you need to run the 64bit version on a 64bit PC or it won't work. I think the 'easiest' way to install SPY++ is to install Visual Studio 2017, be sure to select the C++ payload. For non developers this might be a bit too much work. – Roy T. – 2017-05-12T08:27:11.013
2This is perfect. Elaborate, but perfect! – angularsen – 2017-05-24T21:04:15.510
17Great answer! Just a note that the 64-bit version of Spy++ catches only messages for 64-bit applications, so if you don't see the WM_HOTKEY message in the Message log after pressing the hotkey, you may need to run the 32-bit version of Spy++. – Dawid Ferenczy Rogožan – 2017-07-17T14:54:26.390
Link should be updated to new documentation site. For Visual Studio 2017, the only required payload is "Visual C++ core desktop features". Application specific hotkey is not logged? For example, Ctrl + B in MS Word will make the text bold.
Thank you so much for this. I FINALLY found out what was stealing Ctrl Shift F from me. (It was Razer Cortex). Another note is that sometimes spy++ will crash when you try to view the properties. (And then you cannot see any more hooks until rebooting.) I was able to resolve this by right clicking, before step 9, and choosing "Stop Logging Message". At that point, it no longer crashed when I attempted to examine the properties. Thanks again! – Khale_Kitha – 2018-09-21T13:20:50.437
Ctrl-Shift-G (used in Eclipse for searching method references) was taken by Google Drive Real-time Presence. Deactivate it in Google Drive preferences, and the hotkey gets deregistered. – Philipp – 2018-11-14T10:29:25.643
Thanks. This post was very helpful. I was able to realize that Ctrl+Alt+Shif+D (and also AltGr+Shift+D) was eaten by Skype (desktop version). Shame on arrogant Skype developers again for not respecting principles of their own company (Microsoft, again) and stealing shortcuts by convention allowed to be used only by Keyboard Layouts and preventing me from typeing Đ :-(!
BTW if you have Visual Studio installed, the best way to launch Spy++ is to go to start menu, find Developer Command Prompt and once there type spyxx. – Đonny – 2019-05-24T07:50:08.903
1 You can download it from https://github.com/westoncampbell/SpyPlusPlus, http://mdb-blog.blogspot.com/2017/02/download-microsoft-spy-140-2016-06-20.html.
Great answer! This worked for me to find out that it was Zoom responding to ALT SHIFT T and starting an image snapshot process (weird: not Zoom is for). However, it didn't capture the suggest WIN+R hotkey in your instructions which confused me initially as I tried that first to confirm I'd followed your steps correctly. Any ideas why? – Gruff – 2019-07-27T12:55:29.193
6
This has probably been answered on Stack Overflow in this thread:
Find out what process registered a global hotkey? (Windows API)
Here's Pauk's answer:
Your question piqued my interest, so I've done a bit of digging and while, unfortunately I don't have a proper answer for you, I thought I'd share what I have.
I found this example of creating keyboard hook (in Delphi) written in 1998, but is compilable in Delphi 2007 with a couple of tweaks.
It's a DLL with a call to
SetWindowsHookExthat passes through a callback function, which can then intercept key strokes: In this case, it's tinkering with them for fun, changing left cursor to right, etc. A simple app then calls the DLL and reports back its results based on a TTimer event. If you're interested I can post the Delphi 2007 based code.It's well documented and commented and you potentially could use it as a basis of working out where a key press is going. If you could get the handle of the application that sent the key strokes, you could track it back that way. With that handle you'd be able to get the information you need quite easily.
Other apps have tried determining hotkeys by going through their Shortcuts since they can contain a Shortcut key, which is just another term for hotkey. However most applications don't tend to set this property so it might not return much. If you are interested in that route, Delphi has access to
IShellLinkCOM interface which you could use to load a shortcut up from and get its hotkey:uses ShlObj, ComObj, ShellAPI, ActiveX, CommCtrl; procedure GetShellLinkHotKey; var LinkFile : WideString; SL: IShellLink; PF: IPersistFile; HotKey : Word; HotKeyMod: Byte; HotKeyText : string; begin LinkFile := 'C:\Temp\Temp.lnk'; OleCheck(CoCreateInstance(CLSID_ShellLink, nil, CLSCTX_INPROC_SERVER, IShellLink, SL)); // The IShellLink implementer must also support the IPersistFile // interface. Get an interface pointer to it. PF := SL as IPersistFile; // Load file into IPersistFile object OleCheck(PF.Load(PWideChar(LinkFile), STGM_READ)); // Resolve the link by calling the Resolve interface function. OleCheck(SL.Resolve(0, SLR_ANY_MATCH or SLR_NO_UI)); // Get hotkey info OleCheck(SL.GetHotKey(HotKey)); // Extract the HotKey and Modifier properties. HotKeyText := ''; HotKeyMod := Hi(HotKey); if (HotKeyMod and HOTKEYF_ALT) = HOTKEYF_ALT then HotKeyText := 'ALT+'; if (HotKeyMod and HOTKEYF_CONTROL) = HOTKEYF_CONTROL then HotKeyText := HotKeyText + 'CTRL+'; if (HotKeyMod and HOTKEYF_SHIFT) = HOTKEYF_SHIFT then HotKeyText := HotKeyText + 'SHIFT+'; if (HotKeyMod and HOTKEYF_EXT) = HOTKEYF_EXT then HotKeyText := HotKeyText + 'Extended+'; HotKeyText := HotKeyText + Char(Lo(HotKey)); if (HotKeyText = '') or (HotKeyText = #0) then HotKeyText := 'None'; ShowMessage('Shortcut Key - ' + HotKeyText); end;If you've got access to Safari Books Online, there is a good section about working with shortcuts / shell links in the Borland Delphi 6 Developer's Guide by Steve Teixeira and Xavier Pacheco. My example above is a butchered version from there and this site.
Hope that helps!
1which version of windows? – Ivo Flipse – 2009-07-23T09:52:52.173