Touch Screen Calibration (WinCE)
This article will explain how to do touch screen calibration in WinCE.
Touch Screen Calibration using Control Panel
- Click on Start->Settings->Control Panel->Stylus->Calibration->Recalibrate.
- Calibrate the five point accurately.
- Press ENTER if keyboard is connected else TAP on the screen, it will exit the calibration screen.
- Save registry from Start->Programs->ColibriTools->SaveReg.
Touch Screen Calibration from code
BOOL WINAPI TouchCalibrate(void) function is used to calibrate touch screen in WinCE.
For more information visit msdn
C/C++
int wmain()
{
TouchCalibrate();
if( ERROR_SUCCESS != RegFlushKey( HKEY_LOCAL_MACHINE))
RETAILMSG( 1, (TEXT("Save Key failed (%d)\n"), GetLastError() ));
return 0;
}
Visual C#
using System;
using System.Linq;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices; //To use C Win32 functions
namespace CSharp_TouchScreen_Calibration
{
public partial class Form1 : Form
{
[DllImport("coredll")]
private static extern bool TouchCalibrate(); //import function from coredll
[DllImport("coredll.dll", EntryPoint = "RegFlushKey", SetLastError = true)]
public static extern uint RegFlushKey(uint hKey); //import function from coredll
const uint HKEY_LOCAL_MACHINE = 0x80000002;
public Form1()
{
InitializeComponent();
touchCalibrate();// function will be called on Form Load
}
public void touchCalibrate()
{
TouchCalibrate();
RegFlushKey(HKEY_LOCAL_MACHINE);
}
}
}
Note: To save registry from code use RegFlushKey function.
Troubleshooting: Calibration Process Repeats Forever
If the touchscreen calibration values are outside the required quality (after touching the 5 points on the screen), the calibration is rejected, and the process starts over. This is typically a sign of too much noise on the analog signals, or inadequate timing settings of the touch measurement process.
The suggested measures are:
- Refer to the separate page about touch screen registry settings in order to optimize the measurement settings for your touch screen
- To overrule the touch calibration process, and allow for a wider quality span, add the following registry settings:
[HKEY_LOCAL_MACHINE\Hardware\DEVICEMAP\Touch]
"MaxCalError" = DWORD:100