Check if hotkeys registered with WM_SETHOTKEY should be checked too
RegisterHotKey isn't the only method that can be used to register a hotkey. Application can post WM_SETHOTKEY message to a window to assign a hotkey to it, but this is a different kind of hotkeys than hotkeys registered by using the mentioned system call.
Explore the topic and check if hotkeys registered with WM_SETHOTKEY are:
- global,
- blocking other combinations,
- worth taking into account in HKD.
According to Microsoft documentation, the hotkey brings up the associated window into a foreground, but only when the message is passed to DefWindowProc. What happens when it is serviced by the application instead, and never makes it to the default window procedure?
Links
https://learn.microsoft.com/en-us/windows/win32/inputdev/wm-sethotkey https://learn.microsoft.com/en-us/windows/win32/menurc/wm-syscommand
Hotkeys registered with WM_SETHOTKEY are indeed global, and can block key combinations equally the same as those registered with RegisterHotKey (verified with Hotkey Tester #27).
When hotkey registered with WM_SETHOTKEY is pressed, two scenarios are possible:
- When the window, to which the hotkey is attached, is the active window (i.e. receives keyboard input), the window gets
WM_SYSCOMMANDmessage, withSC_HOTKEYwParam. - When the window is not active (background, minimized, etc.), the window gets
WM_ACTIVATEmessage, but DO NOT getsSC_HOTKEYat this point.
That means tracking SC_HOTKEY is not enough. Hotkey Detective must spy for all windows receiving WM_ACTIVATE and then try to get the hotkey with WM_GETHOTKEY.