7

Which one should I use? I'm only using Windows 8.x, so I don't care about the fact that WM_POINTER is not backwards compatible with Windows 7 etc. I also don't care about gestures; only about raw touches. WM_POINTER's only clear advantage seems to be that it unifies touch and mouse input (but that's easy to work around with WM_TOUCH because mouse events can be checked with GetMessageExtraInfo()). Ease of use is also not an issue; I've been using WM_TOUCH already and I'm just wondering if I should switch to WM_POINTER. My overriding concern is latency and efficiency (game-related application). I can't tell whether WM_POINTER is a wrapper over WM_TOUCH that has extra overhead. Any comments?

Display Name
  • 2,323
  • 1
  • 26
  • 45

2 Answers2

6

WM_TOUCH is obsolete. Use WM_POINTER exclusively. (WM_TOUCH is actually a wrapper over WM_POINTER.)

GetMessageExtraInfo is also notoriously fragile. You have to call it immediately after calling GetMessage, or else you run the risk of intermediate function calls making a COM call or doing something else that results in calling GetMessage.

Eric Brown
  • 13,774
  • 7
  • 30
  • 71
  • 1
    But WM_TOUCH returns an array of touch events with the subsequent GetTouchInputInfo(), whereas WM_POINTER* means a separate message for each touch event with associated window procedure call. Isn't the latter less efficient in a multi-touch situation? – Display Name May 23 '14 at 22:16
  • 3
    @DisplayName You're doing it wrong. :) Look at [GetPointerFrameInfo](http://msdn.microsoft.com/en-us/library/windows/desktop/hh454879(v=vs.85).aspx) to retrieve an entire set of touch messages at once. If you're the only pointer handler, you can use [SkipPointerFrameMessages](http://msdn.microsoft.com/en-us/library/windows/desktop/hh454912(v=vs.85).aspx) to discard the remaining pointer messages for the frame. – Eric Brown May 23 '14 at 22:57
  • What is WM_POINTER? All I found on MSDN is a series of message ids like 'WM_POINTERACTIVATE', 'WM_POINTERUPDATE' etc, are they what this thread is about? – Tim Lovell-Smith May 29 '18 at 23:54
  • @TimLovell-Smith Yes. – Eric Brown May 30 '18 at 16:38
0

I know this is responding to a very old question but someone else might find it useful: I wanted the simplified correlation of touch screen X,Y coordinate to screen coordinate provided by WM_TOUCH but needed the native accuracy of the touch digitizer, not the screen coordinates that fairly closely resemble the digitizer data (which is all that are available from WM_TOUCH). I needed this full resolution data for testing a touch screen to spec. You can get the low level coords using raw input, but registering for raw input stops WM_TOUCH messages. So as others stated above, I tried using WM_POINTERxxxxx messages and found that registering for raw HID data does not disable WM_POINTER messages. Problem solved.

Dharman
  • 30,962
  • 25
  • 85
  • 135