This article will explain how to do touch screen calibration in WinCE.
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.