Windows – How to send mouse/keyboard input without triggering LLMHF_INJECTED flag


At the moment I use the SendInput() function but if you install a low level mouse hook the LLMHF_INJECTED is set indicating that the input was injected into the stream. Is there a way of sending mouse and keyboard input so that LLMHF_INJECTED is not set?

Best Solution

Raymond Chen describes this kind of question as an Arms Race. Assume S is the technique to spoof such injections. Then one would see the question here, how do I detect if S was used to inject mouse/keyboard input? The point of this flag is that Microsoft decided that spoofing is possible but detectable.

Related Question