- SendInput and dwExtraInfo
- Posted by micahc@gmail.com on December 27th, 2006
I have two applications, one that has a low level mouse/keyboard hook
and another that injects mouse/keyboard events using SendInput. I need
a way for the first applicaiton to tell whether or not the
keystrokes/mouse inputs have been injected by the second application.
Initially I was just checking (MSLLHOOKSTRUCT->flags & LLMHF_INJECTED)
to see if the event was injected but it turns out my mouse driver
software injects the middle mouse button so my first application can't
tell whether the input was injected by my application or by the mouse
driver software.
I noticed there is dwExtraInfo in the MOUSEINPUT structure passed to
SendInput and there is a similar dwExtraInfo in the MSLLHOOKSTRUCT.
Can I fill this with user-supplied data so I can flag inputs that I
inject so my first application can tell the difference? If so, how? The
documentation on dwExtraInfo, GetMessageExtraInfo and
SetMessageExtraInfo is extremely limited.
- Posted by micahc@gmail.com on December 30th, 2006
Just giving this a quick little bump to see if anyone can help out. I'm
really at a loss trying to figure out a way to identify injected input
as my own. I tried fiddling with some of the unused portions of the
input but either the data is cleaned out before it gets turned into an
event or it has unwanted side effects (ex: the time value in the
structure is used to determine whether the screen saver should be on or
not).
micahc@gmail.com wrote:
- Posted by micahc@gmail.com on January 7th, 2007
One last bump in futile hopes that someone knows how I can "mark" my
keyboard/mouse inputs as my own so I can handle them differently from
keyboard/mouse input injected by another application.
micahc@gmail.com wrote:
- Posted by micahc@gmail.com on January 12th, 2007
It appears that you can just set a value when injecting keyboard input
and the low level keyboard hook will see that value set when it gets
called. However, the low level mouse hook won't see the data you put
in the injected mouse event unless the cursor is over the window. Is
it a bug that the extra info works differently for the mouse and
keyboard or is there some kind of reasoning behind that?
micahc@gmail.com wrote:
- Posted by Sten Westerback \(MVP SDK\) on February 1st, 2007
Hmm.. sounds like you should consider using some other type of RPC like
named pipes or mailslots to communicate with the other application. At least
i got the impression that you have the code for both.
- Sten
<micahc@gmail.com> wrote in message
news:1168626893.954451.81130@51g2000cwl.googlegrou ps.com...