none
Is it possible to make touch input appear as pen input? RRS feed

  • Question

  • Hello,

    Being inspired by this blog post, I am wondering if it's possible to make input designated as touch input, and designate it as pen input.

    I figured Detours or EasyHook might serve a purpose, but using rohitab's API Monitor, I can't seem to figure out which function to hook and modify.  Specifically, the pointerType property of PointerEvent is of interest, but it is very clear that this isn't a system API, but a javascript API.

    Is there a system API that exposes these types of events?

    Thank you,

    Matt


    • Edited by mbrownnyc Wednesday, June 11, 2014 9:51 PM
    Wednesday, June 11, 2014 1:09 AM

All replies

  • There's no straightforward way to do this. You would need to inject the pen input at the driver level.

    On Windows 8 and later pen, touch, and mouse all use the same pointer API so within your own app you can interpret the pointers interchangeably other than information loss between types (touch has less resolution, no pressure or angle sense, etc.)

    --Rob

    Wednesday, June 11, 2014 5:00 AM
  • Thanks Rob.  I found some very interesting links related:



    I think everyone has the same goal (as me).  I have a touchscreen notebook (Lenovo Twist) without a pen digitizer.  I believe that apps (like OneNote) have palm rejection handled, but it must only take place when pen input is used (is this correct?).

    Basically my goal would be to write a toolbar presented like the Touch keyboard or the Tablet PC Input Panel which activates the action to take Touch input and make it into Pen input.  The end result would be an easy toggle that allows a user to utilize a capacitive stylus (such as the Adonit Jot Script) as pen input on their non-digitizer screen.

    If anyone can confirm that some apps do respect palm rejection only when dealing with pen input, I believe using the method described in the last link for capturing then simulating/injecting pen input would be very good.  Right now, when I hook all Touch APIs with Rohitab's API Monitor and use touch input to interact with any app, I do not see any calls.

    Is the above true?

    Thanks,

    Matt




    • Edited by mbrownnyc Wednesday, June 11, 2014 11:29 PM
    Wednesday, June 11, 2014 10:05 PM
  • Hi Matt,

    The hard part is injecting the pen input since that needs to be done at the driver level. You won't be able to simulate it consistently from user mode. As noted in your links Windows 8 introduced the a touch injection API. Prior to that touch injection required a custom driver to mimic touch hardware. Since there is no such API for pen injection you will need a driver for that. I am not aware of any existing third party virtual pen drivers, although I do know there are projects to create active styluses which work with a custom driver and capacitive screen. 

    Hooking won't help with this. You can get the touch input on your app directly.

    --Rob

    Thursday, June 12, 2014 2:39 PM
  • Thanks for replying Rob.

    Hmm... well... I don't see much of an alternative but to at least give a shot to writing a driver!  Why not?

    What are some resources to get me started on that?  Are there any examples?

    Am I correct in assuming that there is native palm rejection in Windows 8.1 as long as there is pen input?

    Friday, June 13, 2014 12:07 AM
  • To get started with driver development head over to the Windows Hardware Dev Center: http://msdn.microsoft.com/en-US/windows/hardware/gg507680 .

    Windows will turn off touch when an active stylus comes into range.

    --Rob

    Friday, June 13, 2014 12:23 AM
  • Did you end up making any progress here? Looking for something similar, maybe where the user could hold a button in the corner of the screen to enable pen input, where it would begin recognizing the first device/finger to touch the screen as the pen, and ignore any inputs that aren't within about a milimeter (your palm).
    • Proposed as answer by Tablet Pro Sunday, December 18, 2016 12:08 AM
    • Unproposed as answer by Tablet Pro Sunday, December 18, 2016 12:08 AM
    Monday, November 21, 2016 1:35 AM
  • Not sure if this is useful to you but if you are trying to draw with your finger you can use left mouse button down button overlay with drag enabled and use your finger to draw on the screen. It's more of a touch converted to mouse button down event but more programs interpret it the same way minus pressure (we do it in our program). I have a few interesting thoughts regarding touch emulating pen if anyone makes any progress on driver level input.
    • Edited by Tablet Pro Sunday, December 18, 2016 12:11 AM
    Sunday, December 18, 2016 12:11 AM
  • Looking for same in order to test out code on a touch laptop that doesn't have a digitizer.  Mainly it's to exercise the code the way it is with a real stylus.

    Surprised there's still not something  available.  Would be very useful.

    Thanks.

    Tuesday, May 2, 2017 1:34 AM
  • Hi guys,

    It is 2019 now, do you have any progress on the driver/utility that make windows to believe there is a pen writing on its capacitive touch screen yet?

    I developed a new stylus, SonarPen that connects to the audio port of a iOS or Android device and the system will "feel" the pressure by reading the data send back from the audio channel (the XY is handle by the device's touch screen). The pen works perfectly on the mentioned platform and I believe it can be used on Windows tablet with capacitive touch screen too.

    We are looking for a talent to work with us to develop a windows driver or utility that can inject pen event into the system (windows has a new API for the purpose now: https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-injectsyntheticpointerinput )

    If you are interested in taking part, please email to me: hello@sonarpen.com

    Elton

    Monday, March 25, 2019 1:33 AM