3

I'm trying to get the position of finger on laptop touchpad in Delphi. Not the position of cursor on screen. So I can use it for drawing purposes. Is this possible? How can I do this? Is there any Windows API or any component for this?

Thanks for your help.

Update

I found a software for Lenovo touchpad that does the exact thing. It only shows the position of fingers on touchpad and PEiD says it's been written with Visual C++. So I guess it's a possible thing but as David Heffernan said it depends on manufacturer of the touchpad and it's hardware specific.

enter image description here

Community
  • 1
  • 1
Sky
  • 4,244
  • 7
  • 54
  • 83
  • I'd expect any such functionality to require hardware specific driver use. – David Heffernan Sep 28 '14 at 21:15
  • 3
    See [Dr.Bob Examines... #116](http://www.drbob42.com/examines/examinB6.htm) about the Touch and Gestures support by Delphi. And also [Delphi 2010 Tablet PC Support](http://stackoverflow.com/q/4303115/576719). – LU RD Sep 29 '14 at 04:25

2 Answers2

4

Coincidentally, I've just spent the last 30 minutes researching this very thing.

Windows supports this through the touch and gestures APIs. These were introduced in Windows 7 but touchpad drivers didn't tend to offer the necessary support until Windows 8 arrived and made it a logo requirement.

Synaptics and Alps seem to be the principal touchpad manufacturers and they have both released updated drivers for Windows 8 which also work on Windows 7. "Multitouch" is the keyword to search for. This is touchpad-model dependent though; I can't find an update for older Alps devices.

In short, this should work on a "Designed for Windows 8" laptop. It may work on Windows 7 and if it doesn't you may be able to get an updated driver.

arx
  • 16,686
  • 2
  • 44
  • 61
2

The short answer is generally no, this is not possible. Touchpad drivers present to the operating system such that they appear and behave like a mouse does. Absolute coordinates are not available. For this application you need a proper touchscreen device or tablet, at least if you are looking for a general solution that is supported by the operating system.

Some touchpads may provide this information through a hardware-specific driver, of course, but you would need to support, where this is even an option, each device independently. Synaptics, for example, provides an SDK and drivers that can expose the absolute coordinate information.

For tablets or other full-screen digitizers that are supported as "Pen and Touch" inputs, this information is usally obtained through the WM_TOUCH message. Some advanced touchpads may support this - you can always query to discover what features are supported. For those that are, you have to register your application's window to recieve touch messages as detailed here :

Getting Started with Windows Touch Messages

Upon receiving a WM_TOUCH message you can obtain detailed information by immediately passing the touch handle to GetTouchInputInfo. Which returns an array of TOUCHINPUT structures, each carrying information about each active touch point on the digitizer surface.

J...
  • 30,968
  • 6
  • 66
  • 143