I found this in a few different places around the 'net - hopefully it's helpful:

Use the On-Screen Keyboard

An on-screen keyboard is built into Windows XP. It can be useful if you have mobility impairments, if you are using a tablet PC, or if your keyboard breaks down unexpectedly.

To access the on-screen keyboard:

  • Go to Start, then click Run, and then type osk.

Now the keyboard opens on your computer screen, featuring three typing modes you can use to type data:

  • Clicking mode, where you click the on-screen keys.
  • Scanning mode, where you press a hot key or use a switch-input device to type highlighted characters.
  • Hovering mode, where you use a mouse or joystick to point to a key, which is then typed.

To make a shortcut icon on your desktop to the on-screen keyboard:

  • Right-click the desktop and choose New, then Shortcut.
  • Type osk, click Next.
  • Type a name for the shortcut, and then click Finish.

Recommended Answers

All 17 Replies

Is there anyway to size the OSK application? I wish to integrate it with a touch screen and the keys are way too small .
Thanks,
JG

The XP onscreen keyboard is great, I've used it many times with learners. However on hi-res screens its tiny and I have not found and obvious tweaks to scale it. Longhorn (when it comes out) will sort the problem. I bet its possible to write a C++ routine and install it through the registry but that's rather scientific.

I got the screen res to 640 X 480 to alleviate the problem. The OSK is also problematic when you try to use the alt and control keys while scanning. It works fine though for simple text processing.
Rgds

ACTUALLY I was able to solve the problem :)

I can use the following code to RESIZE the Onscreen keyboard (OSK.exe) within my C# program. :idea:
Sample code follows:

using System.Runtime.InteropServices;
...


public class MyClass {



private const uint SWP_NOSIZE           = 0x0001;
private const uint SWP_NOMOVE           = 0x0002;
private const uint SWP_NOZORDER         = 0x0004;
private const uint SWP_NOREDRAW         = 0x0008;
private const uint SWP_NOACTIVATE       = 0x0010;
private const uint SWP_FRAMECHANGED     = 0x0020;
private const uint SWP_SHOWWINDOW       = 0x0040;
private const uint SWP_HIDEWINDOW       = 0x0080;
private const uint SWP_NOCOPYBITS       = 0x0100;
private const uint SWP_NOOWNERZORDER    = 0x0200;
private const uint SWP_NOSENDCHANGING   = 0x0400;


[DllImport("user32.dll")]
public static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);


[DllImport("user32.dll")]
static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int X,
int Y, int cx, int cy, uint uFlags);


[DllImport("user32.dll")]
static extern bool SetForegroundWindow(IntPtr hWnd);


......


private void showKeypad()
{


process = new Process();


process.StartInfo.UseShellExecute = false;
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.RedirectStandardError = true;
process.StartInfo.CreateNoWindow = true;
process.StartInfo.FileName = "c:\\winnt\\system32\\osk.exe";
process.StartInfo.Arguments = "";
process.StartInfo.WorkingDirectory = "c:\\";
process.Start();                                            // Start Onscreen Keyboard
process.WaitForInputIdle();


SetWindowPos( process.MainWindowHandle,
this.Handle,                         // Parent Window
this.Left,                            //  Keypad Position X
this.Top+20,                       //   Keypad Position Y
panelButtons.Width,             //    Keypad Width
panelButtons.Height,            //    Keypad Height
SWP_SHOWWINDOW | SWP_NOZORDER);  // Show Window and Place on Top


SetForegroundWindow(process.MainWindowHandle);
}
}

johngnazoo, thank you for your comments. I have been trying a find a solution to the OSK resize problem for a while. Although I am not much familiar with C#, I have vast experience with other languages. Could you please send me the complete code for the OSK resize. Some small tips on how to get it running would be useful too. I have tried to run your sample code without the "......" but could not get it to work.

Thanks!

ACTUALLY I was able to solve the problem :)

I can use the following code to RESIZE the Onscreen keyboard (OSK.exe) within my C# program. :idea:
Sample code follows:

using System.Runtime.InteropServices;
...

public class MyClass {


private const uint SWP_NOSIZE           = 0x0001;
private const uint SWP_NOMOVE           = 0x0002;
private const uint SWP_NOZORDER         = 0x0004;
private const uint SWP_NOREDRAW         = 0x0008;
private const uint SWP_NOACTIVATE       = 0x0010;
private const uint SWP_FRAMECHANGED     = 0x0020;
private const uint SWP_SHOWWINDOW       = 0x0040;
private const uint SWP_HIDEWINDOW       = 0x0080;
private const uint SWP_NOCOPYBITS       = 0x0100;
private const uint SWP_NOOWNERZORDER    = 0x0200;
private const uint SWP_NOSENDCHANGING   = 0x0400; 

[DllImport("user32.dll")]
public static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);

[DllImport("user32.dll")]
static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int X,
            int Y, int cx, int cy, uint uFlags);

[DllImport("user32.dll")]
static extern bool SetForegroundWindow(IntPtr hWnd);

......

private void showKeypad()
{
            
process = new Process();

process.StartInfo.UseShellExecute = false;
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.RedirectStandardError = true;
process.StartInfo.CreateNoWindow = true;
process.StartInfo.FileName = "c:\\winnt\\system32\\osk.exe";
process.StartInfo.Arguments = "";
process.StartInfo.WorkingDirectory = "c:\\";
process.Start();                                            // Start Onscreen Keyboard
process.WaitForInputIdle();
            
SetWindowPos( process.MainWindowHandle,
this.Handle,                         // Parent Window
this.Left,                            //  Keypad Position X
this.Top+20,                       //   Keypad Position Y
panelButtons.Width,             //    Keypad Width
panelButtons.Height,            //    Keypad Height
SWP_SHOWWINDOW | SWP_NOZORDER);  // Show Window and Place on Top

SetForegroundWindow(process.MainWindowHandle);
}        
}

I modified johngnazoo's source code and got it to work. It seems to be very interesting; but please know I'm a novice in C#/NET world.

Currently I can't get the size of window, positions and windows path, so I hardcoded them.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Diagnostics;

classWin32
{
[DllImport("user32.dll", EntryPoint = "SetWindowPos")]
public static extern bool SetWindowPos(
int hWnd, // window handle
int hWndInsertAfter, // placement-order handle
int X, // horizontal position
int Y, // vertical position
int cx, // width
int cy, // height
uint uFlags); // window positioning flags
public const int HWND_BOTTOM = 0x0001;
public const int HWND_TOP = 0x0000;
public const int SWP_NOSIZE = 0x0001;
public const int SWP_NOMOVE = 0x0002;
public const int SWP_NOZORDER = 0x0004;
public const int SWP_NOREDRAW = 0x0008;
public const int SWP_NOACTIVATE = 0x0010;
public const int SWP_FRAMECHANGED = 0x0020;
public const int SWP_SHOWWINDOW = 0x0040;
public const int SWP_HIDEWINDOW = 0x0080;
public const int SWP_NOCOPYBITS = 0x0100;
public const int SWP_NOOWNERZORDER = 0x0200;
public const int SWP_NOSENDCHANGING = 0x0400;
}
namespace OSKTest
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
showKeypad();
}

private void showKeypad()
{
Process process = new Process();
process.StartInfo.UseShellExecute = false;
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.RedirectStandardError = true;
process.StartInfo.CreateNoWindow = true;
process.StartInfo.FileName = "c:\\WINDOWS\\system32\\osk.exe";
process.StartInfo.Arguments = "";
process.StartInfo.WorkingDirectory = "c:\\";
process.Start(); // Start Onscreen Keyboard
process.WaitForInputIdle();
Win32.SetWindowPos((int)process.MainWindowHandle,
Win32.HWND_BOTTOM,
300, 300, 800, 350,
Win32.SWP_SHOWWINDOW | Win32.SWP_NOZORDER);

}
}
}

johngnazoo, thank you for your comments. I have been trying a find a solution to the OSK resize problem for a while. Although I am not much familiar with C#, I have vast experience with other languages. Could you please send me the complete code for the OSK resize. Some small tips on how to get it running would be useful too. I have tried to run your sample code without the "......" but could not get it to work.

Thanks!

To resize the XP OSK:

I made a little utility in vb that you can download as an executable (with installer) from my website. If the keys go blank for any reason there's a reset button that'll fix it.

I like the OSK. I wrote a small app that allows you to use a joystick as a keyboard/mouse so for text entry its good

I found this in a few different places around the 'net - hopefully it's helpful:

Use the On-Screen Keyboard

An on-screen keyboard is built into Windows XP. It can be useful if you have mobility impairments, if you are using a tablet PC, or if your keyboard breaks down unexpectedly.

To access the on-screen keyboard:

  • Go to Start, then click Run, and then type osk.

Now the keyboard opens on your computer screen, featuring three typing modes you can use to type data:

  • Clicking mode, where you click the on-screen keys.
  • Scanning mode, where you press a hot key or use a switch-input device to type highlighted characters.
  • Hovering mode, where you use a mouse or joystick to point to a key, which is then typed.

To make a shortcut icon on your desktop to the on-screen keyboard:

  • Right-click the desktop and choose New, then Shortcut.
  • Type osk, click Next.
  • Type a name for the shortcut, and then click Finish.

Hello, I have been using Microsoft's OSK.EXE (on screen keyboard) for several years now -- on a backup PC / print server etc. I only need a real keyboard to sign on into XP --- rats --- Does anyone know how to run OSK.EXE as part of system start boot/start up? So that OSK.EXE is running from the windows (XP) user login screen?
How is this solved for tablet PCs? Thanks in advance, Kevin Waite

possibly. I know other accessibility stuff like high contrast, localisation, stickykeys etc.... works for logging in so maybe its possible.

A malicious user could theoretically replace osk.exe with something else which could then capture passwords though,so i dont know if xp will allow it

When i saw this thread i was wondering what the name of OSK was and i saw it listed a few replies down :)

OSK.EXE

Might try to ifnd this and run it on my computer just for fun :)

EDIT:

I googled and found a link to DL this @ (Its pretty small (Ah man!!))

I found this in a few different places around the 'net - hopefully it's helpful:

Use the On-Screen Keyboard

An on-screen keyboard is built into Windows XP. It can be useful if you have mobility impairments, if you are using a tablet PC, or if your keyboard breaks down unexpectedly.

To access the on-screen keyboard:

  • Go to Start, then click Run, and then type osk.

Now the keyboard opens on your computer screen, featuring three typing modes you can use to type data:

  • Clicking mode, where you click the on-screen keys.
  • Scanning mode, where you press a hot key or use a switch-input device to type highlighted characters.
  • Hovering mode, where you use a mouse or joystick to point to a key, which is then typed.

To make a shortcut icon on your desktop to the on-screen keyboard:

  • Right-click the desktop and choose New, then Shortcut.
  • Type osk, click Next.
  • Type a name for the shortcut, and then click Finish.

This is Murali from Chennai (India) I want small help from you i.e. control the "On Screen Keyboard" with program (code). How will I contact you. Pls help me in this problem...

Thanking you.
Murali A

This is Murali from Chennai (India) I want small help from you i.e. control the "On Screen Keyboard" with program (code). How will I contact you. My mail id (muraliavnprofile@gmail.com) "muraliavnprofile at gmail dot com" Pls help me in this problem...

Thanking you.
Murali A

thanks for sharing this useful knowledge with us.

The on screen keyboard has many uses as mentioned above and one of its main use was that Microsoft was aware of hackers even at that time. So in order not to fall in their traps i.e by using our original keyboard they put forward the on screen keyboard so that the hackers wouldn't know what you are typing on your keyboard because on screen keyboard basically relies on mouse clicks. As most of the hackers use key loggers on screen keyboard prohibits or in other words makes it impossible to let them track our user names passwords bank account numbers and many more. So thats it about the on screen keyboard.
Thank you.
If you have any queries regarding problems on your pc then let me know at the given email address-
softhari@gmail.com

Hi,

using the above code I am able to resize the OSK in Win XP but it' s not working in Windows 7.

Can anyone help me to solve this problem.

Thanks

Create a batch file like below:
open notepad and enter the line between the dashes
name the file Onskreen.bat
@echo off
osk

Once saved make a shortcut on the desktop or wherever. Select Properties on the shortcut and set it to Control + Alt + O it will run every time you want it by using the shortcut keys.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.