How to notify a function that a key of the keyboard is pressed while a given window owns the keyboard focus.