6

For my full screen WPF application, I need to show up the Windows 7 onscreen keyboard, if a user sets the focus on a textfield.

There's no hard keyboard for the panel, just a mouse device to interact with it. In this case I need a onscreen keyboard to fill up the textfields.

The WPF-application is written in C# .Net on the .Net Framework 4.0 Client profile.

Thanks for reply Andi

Charles
  • 50,943
  • 13
  • 104
  • 142
skiller
  • 61
  • 1
  • 2

1 Answers1

5

You can wire up following code to TextBox's GotKeyboardFocus or GotFocus event

Process.Start("systempath..\\osk.exe");
Akash Kava
  • 39,066
  • 20
  • 121
  • 167
  • 1
    or more simply Process.Start("osk"); – SpeziFish May 24 '11 at 12:47
  • @SpeziFish, yes it will work but I am skeptical about resolution of path so I always prefer full path. – Akash Kava May 24 '11 at 13:43
  • @Akash, yes, but I'm not sure if it is always so easy to get the fullpath or if the fullpath is always the same on different os. Maybe with the next patch microsoft moves the file somewhere else :-) – SpeziFish May 25 '11 at 07:46
  • There is a method called Environment.GetSpecialFolder that will return full path. – Akash Kava May 25 '11 at 07:58
  • by the way: you're "skeptical about resolution of path" but want to use special folder. I think it's almost the same problem with it, both are dependent to os, user and location. (We're are very offtopic meanwhile :-) ) – SpeziFish May 25 '11 at 08:34
  • http://msdn.microsoft.com/en-us/library/SYSTEM.ENVIRONMENT.SPECIALFOLDER(v=vs.100,d=lightweight).aspx – Akash Kava May 25 '11 at 08:45
  • You're on the right track: "Special folders are set by default by the system, or explicitly by the user, when installing a version of Windows. [...] The locations of these folders can have different values on different operating systems, the user can change some of the locations, and the locations are localized." So you can count on the specialfolder no more than on the path variable. – SpeziFish May 25 '11 at 09:54