Share via


Overview

Windows 7 gives users the ability to manage applications with the touch of their fingers, using no intermediate device. This expands the stylus-based capabilities of tablet PCs. Unlike other pointing devices, this new capability allows multiple input events at the same time from different pointing locations, and it enables complex scenarios, such as managing applications with ten fingers or with multiple simultaneous users. However, to pull this off, we have to adapt our application's user interface and behavior to support this new input model.

MFC in Visual Studio 2010 has added support for checking Multitouch hardware readiness and simplified the process of receiving touch events.

Objectives

In this Hands-On Lab, you will learn how to manage Multitouch events, including:

  • Processing input from Windows Touch
  • Understanding the implications of manipulating multiple touch events simultaneously
  • Checking for Multitouch hardware existence and readiness

System Requirements

You must have the following items to complete this lab:

  • Windows 7
  • Microsoft Visual Studio 2010 Beta 2 (or later)
  • A Multitouch hardware device

Introduction

To create a Multitouch driven application you can choose one of three approaches: Good, Better, and Best.

The “Good” approach is the easiest of the three. You should design your application user interface with touch ability in mind. Use large and clean Win32 based controls that make a natural interface for better user experience. Touch abilities such as scrolling come from the Win32 controls. There is no need for extra work. For example, try to scroll the document that you are reading now with your fingers! This is the “Good” approach.

The "Better" approach lets the system receive various low-level touch events and passes the result of the heuristics that the system performs with these events to your application as “gestures”. For example, if the user makes a rotation movement on the screen, the system will issue a rotation gesture event with the rotation angle. Although the "Better" approach is easy to use, it has its limitations. Using gestures one cannot get Rotate, Translate, and Scale simultaneously. Also you cannot handle many different touch-based actions at the same time. For example two users that operate different areas of the Window.

The “Best” approach is to read the low-level touch events as the input to the application. Applications like “Piano” or complex controls like multiple sliders that can be operated simultaneously are good examples. For example, run MS Paint, select a drawing tool from the gallery and draw with four of your fingers.

In this Hands-On Lab you will mimic the new MS Paint Multitouch painting feature using the “Best” approach. We will read and use the raw touch events.

About the Multitouch Scratchpad Application

The Multitouch Scratchpad application presents a simple window that allows simultaneously drawing of continuous lines with your fingers. While the folder Source\MFC_WMTouchSource\Starter contains files needed for the exercise, Source\MFC_WMTouchSource\Final contains the completed solution.