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.