An event for a certain key press regardless of focussed control [vb]

76 Views Asked by At

I have read around stackoverflow and found out how to create an event for when a certain key is pressed when a certain control is selected, but I would like to know how to register a key being pressed when any control is selected (edit: on the only window/form)?

1

There are 1 best solutions below

0
On

If you mean only when your form has focus then you can set the KeyPreview property of the form to True and then the form will raise keyboard-related events first, regardless of what child control has focus. If you mean even when your application is not active then you should look into the RegisterHotKey API.