Hello,
I am trying to do something similar to what HID Macros does, but with Autohotkey and AHKHID.
Unfortunately I have not found a way to block the original Key Event yet.
When listening to WM_INPUT you can't seem to block the key event from reaching the focused window, using a low level system hook like WH_KEYBOARD_LL/LowLevelKeyboardProc you can block, but you can't differentiate between different HID devices, as far as I know.
How do you do this in your application?
Thanks a lot for the help! Great application!
Internals: How do you block the original key event?
Re: Internals: How do you block the original key event?
Oh, well I already read the FAQ, that is why I asked for advice as you proposed:
Feel free to ask me what's inside and how does it work, but I spent several hours (or nights tuning all API functions and calls. If you go in the same way, I can advice.
Re: Internals: How do you block the original key event?
I think it's mentioned in that topic.
I have memory mapped file for communication between raw input handling and keyboard hook. So code listening to row input message receives message and stores keyboard and key code into memory. When keyboard hook injected to active application receives regular keyboard message it uses memory mapped file to ask hidmacros whether the key should be blocked or not. Hidmacros know if there's some macro defined for keyboard/key combination and if so it answers through shared memory and regular keyboard message is blocked in the hook - never reach target (active) application.
Hope it helps a bit
I have memory mapped file for communication between raw input handling and keyboard hook. So code listening to row input message receives message and stores keyboard and key code into memory. When keyboard hook injected to active application receives regular keyboard message it uses memory mapped file to ask hidmacros whether the key should be blocked or not. Hidmacros know if there's some macro defined for keyboard/key combination and if so it answers through shared memory and regular keyboard message is blocked in the hook - never reach target (active) application.
Hope it helps a bit
Petr Medek
LUAmacros author
LUAmacros author
Re: Internals: How do you block the original key event?
Hi. Thanks for this util. I do not understand much of these programming technical tums.
And I am trying to find a simple solution for my issue.
I have a usb numeric keypad I want to use for Blender 3D app shortcuts.
I have mapped the + on the keypad with the - HIDMacros.SendKeys "^z" - to get the undo in Blender.
I get the undo but it also zooms in (the + keys original hotkey).
Please, I would appreciate the advice how to block the zoom (original) function.
After that I can map the entire thing and work with it.
Thank you.
And I am trying to find a simple solution for my issue.
I have a usb numeric keypad I want to use for Blender 3D app shortcuts.
I have mapped the + on the keypad with the - HIDMacros.SendKeys "^z" - to get the undo in Blender.
I get the undo but it also zooms in (the + keys original hotkey).
Please, I would appreciate the advice how to block the zoom (original) function.
After that I can map the entire thing and work with it.
Thank you.
Re: Internals: How do you block the original key event?
basically, we are looking for a way to block the original button function.
For example, we want to make the "right click" send a keystroke "k".
But we do not want the right click to happen, only the "k" to happen.
We need to DISABLE the right click, and to allow only the "k" keystroke.
Right now, HID Macros is sending BOTH the right click and the "k" keystroke. But we need to STOP the right click, and send only the "k".
can it be done?
For example, we want to make the "right click" send a keystroke "k".
But we do not want the right click to happen, only the "k" to happen.
We need to DISABLE the right click, and to allow only the "k" keystroke.
Right now, HID Macros is sending BOTH the right click and the "k" keystroke. But we need to STOP the right click, and send only the "k".
can it be done?
Re: Internals: How do you block the original key event?
Hmm, consider mouse macros being more "experimental feature". I introduced this funcionality
a) to use mouse wheel
b) to support toggle switches
For a) it may work with some small limitations (in some situations I'm not able to block original wheel message completely)
for b) there were problems till the beginning so I decided to use DirectX devices (joysticks) for toggle switches.
a) to use mouse wheel
b) to support toggle switches
For a) it may work with some small limitations (in some situations I'm not able to block original wheel message completely)
for b) there were problems till the beginning so I decided to use DirectX devices (joysticks) for toggle switches.
Petr Medek
LUAmacros author
LUAmacros author
Re: Internals: How do you block the original key event?
Hello Petr,
First of all - greate work!
(I was searching for distinguish barcode scanner input (that connects as normal HID device) from keyboard input - because I`like to do something else with the barcode...)
With your greate programm it works - but from time to time the hook is released - and the barcode input is passed as normal input again (so I have to restart luamacros)
Luamacros itselvs seams to work all the time - the barcode input is detected correctly all the time. The only thing is, that eg. after having locked the pc the `hook` doesn't work anymore and luamacros grab the scanner input, but the scanner input also is passed as normal keyboard input to windows too.
Is there a solution (what do I wrong)?
How to detect, if the `hook` is still working?
Thank you
Thomas
First of all - greate work!
(I was searching for distinguish barcode scanner input (that connects as normal HID device) from keyboard input - because I`like to do something else with the barcode...)
With your greate programm it works - but from time to time the hook is released - and the barcode input is passed as normal input again (so I have to restart luamacros)
Luamacros itselvs seams to work all the time - the barcode input is detected correctly all the time. The only thing is, that eg. after having locked the pc the `hook` doesn't work anymore and luamacros grab the scanner input, but the scanner input also is passed as normal keyboard input to windows too.
Is there a solution (what do I wrong)?
How to detect, if the `hook` is still working?
Thank you
Thomas
Re: Internals: How do you block the original key event?
Thanks.
Hard to say. Maybe you can turn on verbose logging and see (after losing the funcionality) if logs says something different or interesting.
Hard to say. Maybe you can turn on verbose logging and see (after losing the funcionality) if logs says something different or interesting.
Code: Select all
lmc_log_all();
lmc_log_spool('this_will_be_long.log')
Petr Medek
LUAmacros author
LUAmacros author