If you want to know the key that is pressed but just inside a form, it is easy: Set the KeyPreview property to True, and then in the Form_KeyPress event to have the parameter Keyascii with the code of the key that was pressed.
If you need keys like cursor keys and function keys and all the non printing keys, then use the Form_KeyDown event and in the KeyCode parameter you have the code of the key.
If you need to know what key is pressed, but in the entire system, then you need to install a hook.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.