I have a bit of an odd question pertaining to Windows: is there any way to globally determine the last time that any key, or in particular, the modifier key (aka alt
) was pressed without resorting to drivers or kernel-mode code?
Some background: I have registered a global shortcut (alt+`) and successfully run code when it is executed. Currently, I use some heuristics that are very much fallible to determine if the user is repeatedly pressing and releasing the backtick key while the alt key is consistently held down or if the user has pressed and released both since the last time my hotkey handler was called.
I wish to more-precisely ascertain whether or not the alt key has been released since the last time my handler was called. Being able to uniquely identify the time of the last alt keypress is an obvious solution. Another is somehow hooking on to each alt key press to record that info, which I do not believe is possible.
I'm open to all ideas and suggestions!