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...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

hooking keyboard input twice 0
local keyboard hook 2
keyboard hooks in C# 13
Global WM_CREATE hook... 2
Hooking the keyboard 2
Raw Input Global Hooks 0
HELP - Global hooks 1
Keyboard Hooking including Unicode 2

Back
Top