none
How can I capture the touch pressure in my c++ application? RRS feed

  • Question

  • Hi there,

    I'd like to add functionality to my c++ application to work with the pressure sensitivity of the stylus pen and touch screens. The more pressure that is applied, the thicker the line being drawn would appear.

    Is there a way to capture the pressure information somehow?

    Tuesday, April 19, 2016 8:17 PM

Answers

  • Hi Caryd,

     

    >>"Is there a way to capture the pressure information somehow?"

     

    If you want to make a Windows metro style app on Windows 8.1 or Windows 10, you could use InkManager class which provides properties and methods to manage the input, manipulation, and processing of one or more InkStroke objects. There is an example on Github which shows us how to capture the pressure information. Even though it is written in C#, I think it is easy to convert to C++.

    https://github.com/MJZawacki/InkDemo

     

    In addition to this, if you want to capture the pressure information in legacy desktop application. You could use IRealTimeStylus::GetPacketDescriptionData method to retrieve the information from stylus device. This ppPropertyGuids parameter returns an array of globally unique identifier (GUID) that indicates which property values are present in the packet data. One of the property is GUID_NORMAL_PRESSURE. This is the pressure of the pen tip perpendicular to the tablet surface. The greater the pressure on the pen tip, the more ink that is drawn.

    HRESULT GetDesiredPacketDescription(
    
      [in, out] ULONG *pcProperties,
    
      [out]     GUID  **ppPropertyGuids
    
    );

    For more information, link below is for your reference.

    https://msdn.microsoft.com/en-us/library/windows/desktop/ms700679(v=vs.85).aspx

     

    Best Regards,

    Li Wang


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, April 22, 2016 4:19 AM