5
Answers

C# Catch a Key and Suppress it?

Alex

Alex

16y
6.9k
1
Hello, as all my searches have come up dry, and I've gotten a bit rusty with c# in the last couple months, I decided to ask this here.

Basically I need to catch any and all key presses (shift, alt, control, Letters, Numbers, as well as other function keys on a keyboard) record and suppress them before they get to whatever application is currently in the forground while the variable is set to true. Basically one key on the keyboard will toggle the variable between true and false, but the real issue is Getting the key presses and suppressing them. I know KeyEventArgs and SuppressKeyPress come into play, but due to the nature of what I need, the majority of the details on it have been hidden. Any assistance would be greatly appreciated.
Answers (5)
0
Osman Esen
NA 10 2.6k 12y
My PC har to communicate with a kit. For instance, i have to write a random value of power consumption in the textbox, and send that value to the kit.

It is important for the kit to receive the values as a number, because the kit controls a "plastic made" flower, which will react dependent on the power value. So the only job i will do with C#, is to write the values in the textbox and send those values with pressing "send" button.


0
Satyapriya Nayak
NA 53k 8m 12y
Please elaborate it more