2

I would like to build my own virtual keyboard for my windows 7 tablet. I am not starting from zero in programming; I just have no idea on where to start to make a system level device like a virtual keyboard.

Is there a good article or SDK for this?

  • There's two approaches to this: write a program that sends keystrokes to other programs (`SendKeys`), or write a program combined with a device driver that acts like an actual physical keyboard. The latter is much more difficult, but allows some scenarios that `SendKeys` doesn't permit. – Stephen Cleary Jun 24 '11 at 19:11
  • Sendkeys won't work since it doesn't trigger a key interupt. –  Jun 24 '11 at 21:09

2 Answers2

4

You'll need to write a driver in order to truly get a virtual keyboard. Keyboard drivers cannot be written in C#.

Drivers are written in C (not even C++; just C), and they use the Windows Driver Kit for development. There is insufficient documentation, period (the sooner you admit this, the better). Pick up a copy of the following books if you don't already have them: Windows Internals, Advanced Windows Debugging, Oney's Programming the Windows Driver Model, and Developing Drivers with the Windows Driver Foundation. I strongly recommend using KMDF, since it makes writing drivers only extremely difficult rather than insanely near-impossible. Subscribe to OSR's NTInsider and read their mailing list archives (they are the only source I know that has all the missing details on driver writing). Begin working your personal contacts because there's a medium-to-high chance you'll need to talk to someone deep within Microsoft.

To be brutally honest, it is a lot easier to hire an existing expert in the field. Driver development is not cheap, but it's cheaper than doing it yourself.

Stephen Cleary
  • 437,863
  • 77
  • 675
  • 810
  • Final decision: The whole issue is made moot with the release of Windows 8. –  Feb 22 '12 at 22:12
0

Here's an old C++ article on the matter.

http://www.codeproject.com/KB/cpp/onscreenkeyboard.aspx?display=PrintAll&fid=500&df=90&mpp=25&noise=3&sort=Position&view=Quick&fr=26&select=1605922

But I think you'll wind up using SendKeys in C# - http://www.codeproject.com/KB/cs/SendKeys.aspx

Brandon Boone
  • 16,281
  • 4
  • 73
  • 100
  • After a cursory look at the C++ solution, it merits more investigation. Thx. –  Jun 24 '11 at 21:18