织梦CMS - 轻松建站从此开始!

罗索

WinCE Touch Panel校准

落鹤生 发布于 2010-10-15 13:51 点击:次 
关于屏幕校准,有一点值得说的是,据我所知,注册表的 HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\TOUCH的CalibrationData项保存有屏幕校准数据
TAG:

PB自带的触摸屏校准代码D:\WINCE420\PUBLIC\COMMON\OAK\DRIVERS\TOUCH

!18M!8Xea 可以参考PLATFORM BUILDER的帮助文档:

Windows CE Features > Shell and User Interface > User Interface > Touch Screen (Stylus) ------CE5.0

z 9k3@\7         Platform Development > Developing Platform Elements > Customizing the User Interface > Touch Screen Calibration Reference -------CE4.2

Touch Panel校准过程如下:

1)调用TouchPanelEnable启动触摸屏

2)调用TouchPanelGetDeviceCaps,通过设置参数TPDC_CALIBRATION_POINT_COUNT_ID来获得校准用触点的个数

3)取校准点,对每个校准点都有以下过程

   A:调用TouchPanelGetDeviceCaps,设置参数TPDC_CALIBRATION_POINT_ID来获得校准点坐标

   B:在上述校准点坐标处画十字,并等待用户点击

   C:调用TochPanelReadCalibrationPoint来获得上述校准点坐标处触摸屏对应的数据

4)当取完校准用的所有的点,调用TouchPanelSetCalibration来计算校准系数,该函数实现没有找到

程序流程:

TouchPanelGetDeviceCaps-->

DdsiTouchPanelGetDeviceCaps(参数为TPDC_CALIBRATION_POINT_ID)-->

TouchDriverCalibrationPointGet(得到校准点之一的坐标,该坐标为screen坐标)

英文资料如下:

The following steps detail the basic algorithm that you, the driver developer, can use to sample and calibrate the screen with the touch screen driver:

  1. Call the TouchPanelEnable function to start the screen sampling.
  2. Call the TouchPanelGetDeviceCaps function to request the number of sampling points.
  3. For every calibration point, perform the following steps:
    1. Call TouchPanelGetDeviceCaps to get a calibration coordinate.
    2. Draw a crosshair at the returned coordinate.
    3. Call the TouchPanelReadCalibrationPoint function to get calibration data.
  4. Call the TouchPanelSetCalibration function to calculate the calibration coefficients.
      Wince的cordll提供了屏幕校准的函数,使用方法强制加载dll,获取地址,然后用函数指针调用。这里给出源代码。
      首先在头文件里加入函数指针定义:
            typedef BOOL (WINAPI *_TouchCalibrate)();
      然后使用如下代码,就会出现屏幕校准画面了。
  1. HINSTANCE hinstance = LoadLibrary(_T("coredll.dll")); 
  2. if (hinstance == NULL) 
  3.      AfxMessageBox (L"instance == NULL"); 
  4.       return
  5. _TouchCalibrate TouchCalibrate = NULL; 
  6. TouchCalibrate = (_TouchCalibrate)GetProcAddress(hinstance , L"TouchCalibrate"); 
  7. if (TouchCalibrate == NULL) 
  8.       AfxMessageBox (L"TouchCalibrate == NULL"); 
  9.       return
  10. TouchCalibrate (); 
  11. FreeLibrary(hinstance ); 
      关于屏幕校准,有一点值得说的是,据我所知,注册表的 HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\TOUCH的CalibrationData项保存有屏幕校准数据,所以 如果注册表是基于RAM的话,那么屏幕校准的结果将得不到保存,系统断电重启后需要再次校准(如果用户觉得有必要的话)。如果谁有不用hive注册表就能 保存上次的屏幕校准结果,请不吝赐教。


      要自已写一个触摸屏的校准应用程序该怎么写?
      有没有那位大哥做过?给点提示了!急啊!
      我用微软private下面的一个TOUCHTEST的里面的测试代码试,校准完了触摸屏就没反应了?
      我的程序顺序是这样:LoadDrvier-->TouchPanelEnable-->TouchPanelGetDeviceCaps-->TouchPanelReadCalibrationPoint
--->TouchPanelSetCalibration-->FreeDriver.
      校准完了后系统的触摸屏就没反应了! ]-Z=" Y PY T+_ pm DDN [NE : $ @ ~bSPtH ]6d 1m*fk M#

 

(ch_ff)
本站文章除注明转载外,均为本站原创或编译欢迎任何形式的转载,但请务必注明出处,尊重他人劳动,同学习共成长。转载请注明:文章转载自:罗索实验室 [http://www.rosoo.net/a/201010/10314.html]
本文出处:百度博客 作者:ch_ff
顶一下
(0)
0%
踩一下
(0)
0%
------分隔线----------------------------
发表评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
评价:
表情:
用户名: 验证码:点击我更换图片
栏目列表
将本文分享到微信
织梦二维码生成器
推荐内容