ITachiLab / hotkey-detective

A small program for investigating stolen hotkeys under Windows 8+
GNU General Public License v3.0
362 stars 16 forks source link

Display pressed combinations which were not assigned to any process #14

Open ITachiLab opened 1 year ago

ITachiLab commented 1 year ago

Following up on a discussion which started in #8.

It would be nice from the user experience point of view if Hotkey Detective could display combinations pressed by the user but which weren't assigned to any application. For the time being, HKD remains silent. The reason for this is lack of system events HKD could receive when the pressed combination was not registered by any process.

Possible solution

Hook on WH_KEYBOARD or WH_KEYBOARD_LL messages to track pressed keys. Hotkey Detective has to parse the pressed keys and detect combinations on its own. When a combination is detected and there were no WM_HOTKEY events caught in the meantime, display this combination in a table as unassigned.

Additionally, HKD can test the possibly unassigned hotkey with RegisterHotKey. When the invocation succeeded, the combination is free indeed. When it failed, that means some process already registered the combination, but it wasn't detected which one, probably because it runs on a different processor architecture. User should be encouraged to try again but with the other HKD version.

Remember to UnregisterHotKey as soon as possible!

hkd