Search by Tags

Touch Screen Calibration (WinCE)

 
Applicable for

Article updated at 28 Oct 2017

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.