0

I have a class and I would like to capture a keystroke. I know there are events in a WinForm application for keypresses. I want my class to be able to capture a keystroke, without using WinForms. I know I can create a keyboard hook, but I would prefer not to use that method, as it involves importing other Windows libraries and I would like this to work under Mono, as well as Windows. All I need is the ASCII code of the key pressed. I don't need to capture modifiers, such as ctrl, alt, shift, etc...

Any suggestions?

Icemanind
  • 47,519
  • 50
  • 171
  • 296
  • Suppose it would be possible so easily, then you could read my password from another program while I am typing. – L.B Nov 27 '14 at 20:48
  • There is no way built into the framework, so you'll have to resort to platform-specific code. This is also explained in linked duplicate, and things haven't changed since then. – CodeCaster Nov 27 '14 at 20:53
  • @L.B - Its not for anything like that. I'm creating a virtual machine and I'm trying to keep a separation between the virtual machine logic and the input/output logic. – Icemanind Nov 27 '14 at 20:56
  • @icemanind I am not questioning your intensions, but the result of it. – L.B Nov 27 '14 at 20:58

0 Answers0