Click here to Skip to main content
11,930,069 members (52,281 online)
Click here to Skip to main content
Add your own
alternative version


22 bookmarked

Manage Windows XP On Screen Keyboard

, 22 Apr 2009 CPOL
Rate this:
Please Sign up or sign in to vote.
Windows XP offers an On Screen Keyboard, but sometimes requires a little customization


I was developing an application to be used on a panel PC and I faced the customer request to use only the touchscreen to enter any data required by my application. My first idea was to design by hand a form with as many buttons as a regular keyboard, but I changed my mind immediately. Next, after some web searching, I decided to use the standard on screen keyboard provided by Windows XP. 


When you start the on screen keyboard (OSK.EXE) the first thing you can observe is that it is too small to be used with the resolution of a modern monitor, but the OSK doesn't allow you to resize it. This problem can be easily solved using the SetWindowPos API in order to set the requested size and position. The screen keyboard is presented as a usual application, so it has a window frame with control boxes and a menu. The control box could cause the keyboard application to close if the user clicks on the cross button (window close), and the menu is useless for the normal data entry. Nonetheless, the window frame and the menu consumes screen area. But how to remove these elements? The SetWindowLong API does the job. 

Using the Code

The class exposes three shared methods: 

'Shows the keyboard creating the process if necessary 

'Hides the keyboard without killing the process  

'Kill the process that manages the keyboard 

When you call Show, the keyboard appears at the bottom of the screen, just above the taskbar, and is 350px tall while its width matches the screen width. These parameters are hard coded in the class, but they can be easily changed. 

Hope you enjoy this class. 


  • 22nd April, 2009: Initial post


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Italy Italy
No Biography provided

You may also be interested in...

Comments and Discussions

SuggestionAnother possible way to remove the menu Pin
Member 908914913-Jun-12 13:34
memberMember 908914913-Jun-12 13:34 
I had the same problem mentioned below where the background color would change. After searching around and looking into windows api a bit, I found the following link:[^]

It shows how to programmatically remove menu items from a window. This, coupled with Cbwhyw's solution seems to do the trick.
QuestionUAC question Pin
inbox20-Aug-11 2:44
memberinbox20-Aug-11 2:44 
QuestionHow to prevent background color change when using WS_CHILD? Pin
Olongdomango14-Apr-10 1:22
memberOlongdomango14-Apr-10 1:22 
Questionpossible to view only number keyboard? Pin
Jenhuohuo12-Feb-10 0:59
memberJenhuohuo12-Feb-10 0:59 
GeneralDemo application Pin
Deepak.Prahlad11-Aug-09 22:15
memberDeepak.Prahlad11-Aug-09 22:15 
GeneralYou may incluide a Demo compiled project... Pin
rodrilobo0222-Apr-09 16:12
memberrodrilobo0222-Apr-09 16:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.151126.1 | Last Updated 22 Apr 2009
Article Copyright 2009 by Cbwhyw
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid