How do you get stylus pressure information in windows?

Does anyone know of a sensible way to get tablet / stylus pressure information in Windows?

You can distinguish a stylus from a mouse with :: GetMessageExtraInfo, but you cannot get more information than this. I also found the WinTab API in the corner of the Wacom website path, but this is not part of the windows, as far as I can tell, and it has a completely different event / message system from the message queue.

Given all that I want, this is the most basic pressure information, of course there is a standard Win32 / COM API, does anyone know what it can be?

+6
winapi tablet stylus-pen
source share
3 answers

You need to use the Pen / Ink API for the tablet. The COM version of the API is located in InkObj.dll. Here is the starting point for documentation: http://msdn.microsoft.com/en-us/library/ms700664.aspx

If I remember correctly, InkObj.dll is available in Windows XP Service Pack 2 (SP2) and all subsequent Windows client OS, regardless of whether this computer is a tablet PC.

+2
source share

UPDATE:
It has been several years since I initially provided this answer, but wintab has become the de facto standard, and Ntrig is more or less complex, eventually creating a shell to access the wintab API through this digitizer.
( http://www.tabletpcbuzz.com/showthread.php?37547-N-trig-Posts-WinTAB-Support-Driver )

This is a rather late answer, but my wife and I recently bought a Dell XT tablet, which, as it turned out, uses NTrig, a set of interfaces that use ink, the new windows API that comes with the Windows XP Tablet edition, then SP 2 and all versions after that.

Many Wacom tablets and others use the Wintab API, which is not currently open or approved. From what I hear, people who support him are very satisfied.

So, it depends on what type of tablet you are using and the drivers you installed for it. In my biased opinion, you should work with Ink, since it provides (or at least through NTrig and Windows 7 WILL) the ability to repeatedly click and is likely to become the new standard for tablet interfaces. But at the moment, NTrig devices do not translate pressure and angle information into conventional Wintab-based applications such as Photoshop or Corel Painter. Applications typically require at least some support for the Microsoft Tablet API in order to function properly.

+2
source share

The current way to do this is to handle WM_POINTERnnn msgs. Please note that this is for Win 8 and later.

Please note that you will receive these messages for touch and manual, so you will need to find out the pointerType type to check for a pen. The WPARAM received by WNDPROC for WM_POINTERnnnnn msgs, such WM_POINTERUPDATE and other messages, contains a pointer identifier that you will need to request additional information. Empirically, I found that WM_POINTERUPDATE leads to information that contains pressure data, whereas if the pointer flags point up / down, there is no pressure information.

const WORD wid = GET_POINTERID_WPARAM(wParam); POINTER_INFO piTemp = {NULL}; GetPointerInfo(wid, &piTemp); if (piTemp.pointerType == PT_PEN { UINT32 entries = 0; UINT32 pointers = 0; GetPointerFramePenInfoHistory(wid, &entries, &pointers, NULL); // how many // TODO, allocate space needed for the info, process the data in a loop to retrieve it, test pointerInfo.pointerFlags for down/up/update. } 

Once you know that you are dealing with a pen, you can get pressure information from the POINTER_PEN_INFO structure.

It is like touching a touch, although when you touch, you need to recognize a gesture and inertia. There is a Microsoft example illustrating the use of these features.

This is part of the conversation about construction: https://channel9.msdn.com/Events/Build/2013/4-022

+2
source share

All Articles