首页 | 编程语言 | 网站建设 | 游戏天堂 | 冲浪宝典 | 网络安全 | 操作系统 | 软件时空 | 硬件指南 | 病毒相关 | IT 认证
软讯网络 > 软件时空 > 软件相关 > WinCE下的触控屏驱动程序
【标  题】:WinCE下的触控屏驱动程序
【关键字】:WinCE
【来  源】:http://blog.csdn.net/Mobidogs/archive/2007/02/21/1512323.aspx

WinCE下的触控屏驱动程序

Microsoft Corporation.
Last updated on Tuesday, May 18, 2004
Touch Screen Driver Samples
Sample code for touch screen drivers is provided in the following directories:
  • %_WINCEROOT%\Platform\XSC1BD\Drivers\Touchp
  • %_WINCEROOT%\Public\Common\Oak\Drivers\Touch
Touch Screen Drivers

The touch screen driver reads user input from touch screen hardware and converts it to touch events that are sent to the Graphics, Windowing, and Events Subsystem (GWES). The driver also converts uncalibrated coordinates to calibrated coordinates. Calibrated coordinates compensate for any hardware anomalies, such as skew or nonlinear sequences.

For the touch screen driver to work properly it must submit points while the user's finger or stylus is touching the touch screen. When the user's finger or stylus is removed from the screen, the driver must submit at least one final event indicating that the user's finger or stylus tip was removed. The calibrated coordinates must be reported to the nearest one-quarter of a pixel.

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.

After the touch screen driver executes this sequence, any finger or stylus samples generated for the screen are passed to the callback function specified in TouchPanelEnable. The driver may pass either calibrated or uncalibrated points to the callback. If the driver has an efficient calibration algorithm, it can return calibrated points. However, if the calibration is computationally intensive, the driver may choose to return uncalibrated points, rather than perform extensive calculations in the high-priority driver thread. The lower priority thread processing points from the callback can then perform the calibration.

You can calibrate the screen without an ENTER key. The default calibration code includes a routine called UseEnterEsc. This routine calls the GetKeyboardStatus function to determine whether a keyboard is present, enabled, and supports the ENTER and ESC keys. If so, it prompts the user to use the keyboard to complete the calibration routine. If not, the user is prompted to tap the screen to complete calibration.

Internally, the GWES keyboard code opens HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\KEYBD and searches for a DWORD value called Status. This is a bitmask combining the KBDI_KEYBOARD_XXX values from %_WINCEROOT%\Public\Common\Sdk\Inc\Keybd.h. If Status is not found, GWES uses KBDI_KEYBOARD_PRESENT | KBDI_KEYBOARD_ENTER_ESC | KBDI_KEYBOARD_ALPHA_NUM. This registry access only occurs once, when the keyboard driver is loaded. This bitmask is the basis for what you get when you call GetKeyboardStatus. GWES adds or subtracts the KBDI_KEYBOARD_ENABLED bit based on calls to the EnableHardwareKeyboard function. The KBDI_KEYBOARD_ENABLED bit is set when the keyboard driver is loaded.

When you set the Status registry value, OEMs can then control the type of prompting users get during calibration. If a registry update is not flexible enough for an OEM's platform, the calibration code in %_WINCEROOT%\Public\Common\OAK\Drivers\Calibrui can be modified as appropriate.

The following table shows the touch screen driver functions.

Function Description
DdsiTouchPanelAttach Called when the model device driver's (MDD) DLL entry point gets a DLL_PROCESS_ATTACH message.
DdsiTouchPanelDetach Called when the MDD's DLL entry point gets a DLL_PROCESS_DETACH message.
DdsiTouchPanelDisable Disables the touch screen device.
DdsiTouchPanelEnable Applies power to the touch screen device and initializes it for operation.
DdsiTouchPanelGetDeviceCaps Queries for capabilities of the touch screen device.
DdsiTouchPanelGetPoint Returns the most recently acquired point and its associated tip-state information.
DdsiTouchPanelPowerHandler Indicates to the driver that the system is entering or leaving the suspend state.
DdsiTouchPanelSetMode Sets information about the touch screen device.
ErrorAnalysis Provides information on the accuracy of the touch screen calibration.
TouchPanelCalibrateAPoint Converts uncalibrated points to calibrated points.
TouchPanelDisable Disables the touch screen.
TouchPanelEnable Enables and re-enables the touch screen.
TouchPanelGetDeviceCaps Returns information about the capabilities of the touch screen.
TouchPanelInitializeCursor This function provides an opportunity for touch drivers to move the cursor at initialization time.
TouchPanelPowerHandler Handles power-state change notifications.
TouchPanelReadCalibrationAbort Aborts the currently active call to the TouchPanelCalibrateAPoint function.
TouchPanelReadCalibrationPoint Initiates the process of getting a calibration point.
TouchPanelSetCalibration Initializes calibration information in the vCalcParam global parameter.
TouchPanelSetMode Sets mode information for a touch screen device.

 

 

上海大唐移动招聘软件工程师(C/C++):【上一篇】
驱动SYS开发总结:【下一篇】
【相关文章】
  • 简单自适应的GPS Reader程序实现(WinCE,WM)
  • 漫谈WinCE输入法的编写(二)
  • 漫谈WinCE输入法的编写(一)
  • wince中如何獲取pda的id碼
  • 漫谈WinCE的手写识别技术(三)
  • WinCE内核热更新
  • WinCE 匈牙利命名方法
  • WinCE 程序设计 (3rd 版)--2.3 位图
  • 漫谈WinCE的手写识别技术(二)
  • 漫谈WinCE的手写识别技术(一)
  • 【随机文章】
  • 用VC制作动态弹出的对话框
  • 小问题,大郁闷!当设置location.href属性后,新页面已正常返回,但IE进度条却慢慢走?
  • PHP 用户认证
  • Windows Forms菜单设计全攻略
  • 多核、超线程CPU时代将成就Java性能之王的地位
  • IP基础--6.ICMP协定
  • 学RAID从饮水机开始
  • [Perl]转换十进制为其他任意进制
  • 2003年4月计算机考试二级C语言程序设计笔试试卷
  • 自动化测试的7个步骤
  • 【相关评论】
    没有相关评论
    【发表评论】
    姓名:
    邮件:
    随机码*
    评论*
          
    |  首 页  |  版权声明  |  联系我们   |  网站地图  |
    CopyRight © 2004-2007 软讯网络 All Rigths Reserved.