Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Using triggers with two or more keyboards and mouses
#5
I was corresponding with ken gray regarding these functions, and I am having some difficulty with it.

I installed following the instructions, and it kind of works, but not very well.

I have created a macro which is supposed to execute when I press "p" on the second keyboard, let's call that event "kb2:p". The first time I press kb2:p, it actually does not eat the key event at all, and allows it through to the foreground application, for instance, Notepad. But it works after that. The second time I press kb2:p, it works and the macro fires, and continues to work until I use kb1. Using kb1 seems to prevent any kb2 macros from getting through the first time.

So it's working like this:
kb1: blah blah blah
result: "blah blah blah" sent to active window.
kb2:p
result "p" sent to active window
kb2:p
result: p macro fires.
kb2:p
result: p macro fires.
kb1: blah blah blah
result: "blah blah blah" sent to active window.
kb2:p
result "p" sent to active window
kb2:p
result: p macro fires.
kb2:p
result: p macro fires.

So anyways, I write software too, and I was really curious about what goes on behind the scenes here. I wrote a small test application that uses both Raw Input (to get the keyboard id) and a low level hook (to consume the key event) and the results are interesting.

1) I can detect and deny a keyboard event with the LL hook, but I can't determine the originating keyboard ID.
2) I can determine the originating keyboard ID with RI, but I can't deny they keyboard event from passing through to the foreground application.
3) If I deny a keyboard event with the LL hook, it never bubbles up to the RI hook for origin detection.

So there appears to be a chicken and egg problem here. Is this the reason that the macros on the kb2 work the way that they do? When you see the first kb2:p event, via RI, set a flag that causes the next LL p event to change context to kb2 and then set the context back to kb1 the next time a RI event is received from kb1?

How exactly are you working around what seems to be an inherent limitation of how Raw Input and Low Level keyboard hooks work?


Messages In This Thread

Forum Jump:


Users browsing this thread: 3 Guest(s)