0

I am trying to use the GetPointerPenInfo() function to read pen pressure from the stylus (testing with Wacom Intuos). However, the returned pressure value in the POINTER_PEN_INFO structure is always 0. Do I need to use any other functions along with this one, or perhaps a better way to handle that in general, with WinApi ? Any help and experience with pen pressure would be much appreciated.

Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770
Jarek
  • 29
  • 4
  • How are you using that function exactly? Post your code. – Matteo Italia Feb 22 '16 at 00:28
  • Per the documentation: "*The default is 0 if the device does not report pressure.*". Does your stylus actually support pressure? – Remy Lebeau Feb 22 '16 at 02:15
  • @RemyLebeau The stylus definitely supports pressure - it works in other software. – Jarek Feb 22 '16 at 02:37
  • @MatteoItalia - I realize what I do is a weird way to do things, but it has been working with other WinAPI functions. I am working with scripting language based on VBScript that runs inside Rhinoceros3D application. I am using DynamicWrapperX object that lets me register WinAPI dll libraries and functions and use them within the script that largely expands its capabilities. In my code, DX is the DynamicWrapperX object with the peninfo function registered: `Call DX.GetPointerPenInfo(1, structPenInfo)` the 'structPenInfo is a mem. allocated to receive the proper structure data. – Jarek Feb 22 '16 at 02:40
  • All other data is returned correctly (pixel positions,etc.). Also, no matter if I use pen or mouse, the returned pointer type is always 4 (mouse). I have been testing it with Wacom Cintiq display tablets as well as Intuos graphic tables - both work with pressure. But because the type is wrong too, I wonder If I should do something else to detect proper pen input data. Or - any other WinAPI functions to look at instead ? – Jarek Feb 22 '16 at 02:47
  • You are hard-coding the `pointerId` to 1. Does that match the `pointerId` value that is provided within the `wParam` parameter of the various `WM_POINTER...` window messages? – Remy Lebeau Feb 22 '16 at 05:01
  • @RemyLebeau - no matter which `pointerId` use it does not work. Interestingly the function always returns 4 as the input type (mouse) whether I use Pen or Mouse to move the cursor. I am not doing anything with `WM_POINTER...` messages from the script. Can the result be affected by it, or is that something that the main application (Rhinoceros3D) that my script runs from would need to implement? – Jarek Feb 22 '16 at 19:09
  • `GetPointerPenInfo()` is meant to be used inside a `WM_POINTER...` message handler. [Read the documentation](https://msdn.microsoft.com/en-us/library/windows/desktop/hh454887.aspx): "*Gets the pen-based information for the specified pointer (of type PT_PEN) **associated with the current message**. The information returned by GetPointerInfo is **associated with the most recent pointer message retrieved by the calling thread**. When the next message is retrieved by the calling thread, the information associated with the previous message may no longer be available.*" – Remy Lebeau Feb 22 '16 at 20:55
  • @RemyLebeau - thanks for the insight - I will dig some more - my programming experience is limited to scripting but with the ability of calling WinAPI functions for the scripts I need to learn way more. Again, really appreciate your help. – Jarek Feb 23 '16 at 00:40

0 Answers0