Detecting keystrokes

  • Thread starter Thread starter Frank Rizzo
  • Start date Start date
F

Frank Rizzo

I'd like to detect a condition when a user presses a predefined keyboard
combination. For instance, left shift + right control + 5 on the number
pad.

I've tried the KeyDown event on the form. But I can't determine which
shift (or control) key was pressed (right or left). I've tried
e.KeyCode, e.KeyData, e.Modifiers. Am I missing something really basic?

Thanks
 
Hello Frank,

There is no method/property in .net to decect this, you can use pinvoke to
GetKeyState or keybd_event methods
See samples there http://www.pinvoke.net/search.aspx?search=VK_LSHIFT&namespace=[All]

FR> I'd like to detect a condition when a user presses a predefined
FR> keyboard combination. For instance, left shift + right control + 5
FR> on the number pad.
FR>
FR> I've tried the KeyDown event on the form. But I can't determine
FR> which shift (or control) key was pressed (right or left). I've
FR> tried e.KeyCode, e.KeyData, e.Modifiers. Am I missing something
FR> really basic?
FR>
FR> Thanks
FR>
---
WBR,
Michael Nemtsev :: blog: http://spaces.live.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
 

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

Back
Top