4

I'm working on a WPF app where i want to display the built-in windows 7 onscreen keyboard in a 'always there' manner. So i want to:

  1. Move it to a particular location

  2. Set it to a certain width and height

  3. Remove the caption/titlebar so the user can't move it around or close it

  4. Remove that abilty to resize it (or any other user adjustments for that matter).

I've tried all the typical API functions (MoveWindow, SetWindowPos, SetWindowLong, etc...) but it refuses to do anything. Code currently works with all other processes and apps (such as internet explorer and the command prompt); it's almost as if the api calls don't apply to the osk, or that it's 'locked'. What am i missing? Thanks in advance.

Dat Tau
  • 43
  • 1
  • 5
  • You're right. Window's doesn't want you messing with the OSK, and for good reason: People don't like it when applications customize or change applications they rely on, especially for input and accessibility. What if someone using a tablet needed this for other applications? If you need an On Screen Keyboard, you are probably best off developing your own, or leaving Windows' alone. – vcsjones Apr 10 '11 at 02:47
  • Osk.exe participates heavily in the 'I should always be on top' war between windows. A side-effect of which is that messing with its window doesn't work. – Hans Passant May 24 '11 at 13:01

1 Answers1

4

I checked with Spy++ and the On-Screen Keyboard uses something called "DirectUIHWND". You may wish to look into DirectUIHWND APIs.

A possibly helpful link:

In addition, some people have warned that DirectUI is undocumented.

efotinis
  • 14,565
  • 6
  • 31
  • 36
Zian Choy
  • 2,846
  • 6
  • 33
  • 64
  • ah you're probably right. Sounds like more trouble than i'm willing to get into right now. For other curious minds, the windows osk stores the position and size information in the registry. Just search for "osk". Doesn't quite get me all the way there but it's a start. – Dat Tau Apr 10 '11 at 03:08