none
Catching windows messages globally, or hooking wm_touch RRS feed

  • Question

  • I am writing a c# project(Probably it will be a windows service). I need to run a method after a touch is detected anywhere in the OS(Globally). I did a research about hooking wm_touch, and overriding WndProc, but I faced this issues:

    1. I can only override WndProc in Winforms, and in Winforms it works only inside the form.

    2. I failed to find a solution of how to hook wm_touch in c#.

    Friday, March 30, 2018 2:11 PM

All replies

  • Hello ronflomin,

    Take a look at the below library.

    GlobalMouseKeyHook, It is managed c# code to install global mouse and keyboard hooks. It wraps low level hooks into common windows forms keyboard and mouse events. The below is my running result.

    Best Regards,

    Neil Hu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, April 2, 2018 9:58 AM
    Moderator
  • Hello ronflomin,

    Take a look at the below library.

    GlobalMouseKeyHook, It is managed c# code to install global mouse and keyboard hooks. It wraps low level hooks into common windows forms keyboard and mouse events. The below is my running result.

    Best Regards,

    Neil Hu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Hi,

    Thank you for the reply.

    I am aware of this solution, but it does not include touch hooking.

    I need to install touch hook only.

    Do you know how to do it?

    Tuesday, April 3, 2018 9:13 AM
  • Hello ronflomin,

    I'm sorry that I haven't do any touch global hook before. And after search I find some approaches would be helpful to you.

    How to detect tapping (touch input) globally instead of mouse clicking?

    Best Regards,

    Neil Hu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, April 10, 2018 8:41 AM
    Moderator
  • With what you are busy is called a keylogger and can be used for the highest degree of fraud and is forbidden to give answers for in a Microsoft forum. 

    https://en.wikipedia.org/wiki/Keystroke_logging

     

    Success
    Cor




    Tuesday, April 10, 2018 9:03 AM
  • Hello Fei Hu,

    hope you can help me.

    Maybe you know a bit about mouse hooks.

    I tested the MouseKeyHook library and want to control the scrolling by mouse keys.

    I.e: I want to scroll up and down by the tilt left/right keys (WM_MOUSEHWHEEL).

    When i do this with SendInput, it lags.

    When i do this with SendInput initiated by a button, it works without a delay.

    I use it in combination with GetCursorPos.

    To bypass the hardware initiated input, you can use "e.handled = true". 

    I can't figure out, why it's lagging and i guess i'm technically not that versed to understand it.

    I don't really understand what the "e.handled = true" does but could it be that it's lagging because the message of the input is still be passed to the application window?

    (So i have to create my own hook based on WM_GetMessage and pass WM_Null to avoid the lagging.)

    Regards

    Sunday, September 6, 2020 12:10 AM