c++mouseraw-inputsetwindowshookexdirectinput

How do i prevent a mouse from sending input to DirectInput game?


This question was originally about how to trap mouse events, which i solved after a lot of research using SetWindowsHookEx with C++. Problem is, its working for me on Windows, it works in applications, but it doesnt work in games. can somebody help me understand why the mouse hook doesnt work in some games? could it be possible all the games i tried use Raw Input? :S (i tried Ibb&Obb, Fallout 4, Metro Last Light and some other titles)

Basically im asking: how is it possible to use a Mouse Hook to trap it globally in all the applications running?

thanks for the helpers.

EDIT : I found out that most games i play use DirectInput. guess the better question is: How can i intercept mouse messages in DirectInput and prevent them from being registered by the game? i want to be able to drag the mouse and it would have no effect on the game.


Solution

  • after a lot of research i found out that, from what i understood, API Hooking (Microsoft Detours, API Hijack and more) is the only way to do it. Important note: it doesnt help me much since API Hooking for games require DLL injection which will get you banned from Steam and other platforms.