none
Reading Pen Pressure in C++

    Question

  • I am writing a simple pen application--for compatibility with an existing codebase it must be written in C++, which seems to not be as well supported as the .NET languages for the Pen APIs.  I need to trap each packet at a low level, and do something with every packet that comes in.   By default, each packet contains an X, Y pair in device coordinates.

     

    The way I read the documentation you set the DesiredPacketDescription using GUIDs in msinkaut.h to get additional fields with each packet. 

     

    I set the DesiredPacketDescription to include the GUID for various other factoids, such as NORMAL_PRESSURE and TWISTORIENTATION that I know my Wacom supports (based on diagnostic calls to ITablet::IsPacketPropertySupported).

     

    To make a long story short, I am successfully trapping NewPacket events and for the life of me cannot see anything other than X, Y values in the variant array passed to me. 

     

    I've tried this a couple of ways, a straight COM approach based on the EventSink sample in the Pen SDK, and using the InkPicture control in an MFC dialog.

     

    Can anyone shed some light?

     

    Thanks,

     

    Charlie

     

    Saturday, March 8, 2008 12:38 AM

Answers

  • Hi Charlie.

     

    One thing in addition to what Ramaguru said. Although the API is capable of receiving all of those parameters, few, if any, digitizers report more that X, Y, and pressure. Unless your application will be running on a closely monitored system of Tablet PCs with digitizers that report the other parameters, you may want to skip them.

     

    And please feel free to send suggestions for improving the Tablet PC documentation to mobsdkua@microsoft.com. We monitor that feedback mechanism closely.

     

    Sincerely,

     

    Eliot - MSFT

     

    Tuesday, April 8, 2008 12:26 AM
    Owner

All replies

  •  

    Hello Charlie,

     

    We are looking into this question. I'll update you once I get an answer.

     

    Thank you,

    ramaguru.

    Saturday, March 8, 2008 11:26 PM
  • Hello Charlie,

     

    What OS are you running this on -Vista, XP?

     

    Here is something that may be related to the issue you are seeing, on MSDN: 

     

    From MSDN here:

     

    "In multitablet mode, this is the packet description for all of the tablet devices. If any of the devices don't support a known packet description property, the property data is not returned."

     

    In other words, if you haveanother device on the same machine that does not support anything other than (X,Y), you will not get anything other than (X,Y).

     

    Finally, would it possible to share the code you are running into issues with?

     

    Thank you,

    ramaguru.

     

     

     

     

    Monday, March 10, 2008 6:06 PM
  • I've made some progress on this.  Both versions now work on Vista 32, but not XP  At any rate the data packets now include NORMAL_PRESSURE values.  According to my queries on the Tablet it claims to support YTILTORIENTATION, XTILTORIENTATION, and TWISTORIENTATION.   When I specified these parameters as well in put_DesiredPacketDescription(), I get six longs returned in every packet (X, Y, pressure, x tilt, y tilt, twist), although the last three are always zero.  I assume that's a lazy driver issue and can work with that.

     

    The XP machine (where I still only get (X,Y) pairs) is XP Professional with the pen SDK installed. 

     

    Thanks for the response, Ramaguru.

     

     

    Charlie

     

     

     

     

     

    Tuesday, March 11, 2008 4:28 PM
  • Charlie,

     

    Good to note you have progressed further. If you are using the Wacom driver that shipped in box, that might not be sufficient. You might want to go to their website and double check the driver you are using. Also please let us know the driver you are using.

     

    The Pen SDK you are using is the Tablet PC SDK right?

     

    Thank you,

    ramaguru.

    Wednesday, March 12, 2008 8:45 PM
  • Hi Charlie.

     

    One thing in addition to what Ramaguru said. Although the API is capable of receiving all of those parameters, few, if any, digitizers report more that X, Y, and pressure. Unless your application will be running on a closely monitored system of Tablet PCs with digitizers that report the other parameters, you may want to skip them.

     

    And please feel free to send suggestions for improving the Tablet PC documentation to mobsdkua@microsoft.com. We monitor that feedback mechanism closely.

     

    Sincerely,

     

    Eliot - MSFT

     

    Tuesday, April 8, 2008 12:26 AM
    Owner