global keyboard hook

  • Thread starter Thread starter ofiras
  • Start date Start date
O

ofiras

Hi,
I need my program to do something after a key is pressed. I need to be
able to do different functions for different keys (such as F2, F4...)
I have searched all over the internet, and found a lot of scripts, but
none of them really worked.
Do you know a working code for hooking the keyboard?
Please help,
Ofir.
 
Hi,
I need my program to do something after a key is pressed. I need to be
able to do different functions for different keys (such as F2, F4...)
I have searched all over the internet, and found a lot of scripts, but
none of them really worked.
Do you know a working code for hooking the keyboard?
Please help,
Ofir.

If I understand your goal, then set the KeyPreview property of your form
to true, then handle the KeyDown event. The KeyEventArgs.KeyData will
tell you if the key was an F2, F4, etc...
 
Back
Top