Note that there are some explanatory texts on larger screens.

plurals
  1. POLow level mouse hook and DirectX
    primarykey
    data
    text
    <p>I'm building an application which needs to filter some mouse clicks system-wide. That is, I need to make the system ignore some mouse button clicks at special occasions.</p> <p>I use low level mouse hook and <code>SetWindowsHookEx</code> to filter out these clicks. It works relatively well, except for <code>WPF</code> applications. I guess that's because these applications use <code>DirectX</code> and <code>DirectInput</code> for input processing, and that's why I can't filter out clicks in these applications, since they get the input directly from the driver.</p> <p>Is there any way how to filter clicks in <code>WPF</code>/<code>DirectX</code> applications?</p> <p>I know it is generally not good idea to globally filter clicks, but it is crucial for my application, and I will make sure that it is not filtered in games and other programs. But <code>WPF</code> applications have ordinary <code>GUI</code>, so I need to filter clicks in them as well.</p> <h2>Update</h2> <p>I guess I could solve this problem by writing my own filtering driver, but since I don't have any experience in writing drivers, please let me know if there is any other solution.</p> <h2>API Hooking Resources</h2> <p>I've found some helpful links regarding API hooking. Use this as a reference.</p> <p><a href="http://web.archive.org/web/20040426083909/29a.host.sk/29a-7/Articles/29A-7.019" rel="nofollow noreferrer">Hooking Windows API</a><br> <a href="http://www.codeproject.com/KB/system/hooksys.aspx" rel="nofollow noreferrer">API hooking revealed</a><br> <a href="http://www.codeproject.com/KB/system/APIHookingPart2.aspx" rel="nofollow noreferrer">API hooking revealed Part 2</a><br> <a href="http://www.codeguru.com/Cpp/W-P/dll/hooking/article.php/c3639" rel="nofollow noreferrer">Hijack Textout Calls From Notepad</a><br> <a href="http://help.madshi.net/madCodeHook.htm" rel="nofollow noreferrer">madCodeHook</a><br> <a href="http://sandsprite.com/CodeStuff/IAT_Hooking.html" rel="nofollow noreferrer">IAT Function Hooking</a></p> <h1>FINAL SOLUTION</h1> <p><a href="https://stackoverflow.com/questions/5036143/what-does-wpf-use-to-capture-mouse-and-keyboard-input">WPF does not use DirectInput, but standard Win32 messages for input handling</a> (except for stylus, which is the source for all problems for me, because I use stylus for development, and I wasn't aware WPF apps are stylus-aware). However for filtering clicks in apps that use DirectInput, one would have to hook API, as the accepted answer explains.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload