I'm working on a project to use my second keyboard to do all sorts of cool stuff, for which I'm using LUAMacros for some tasks, and sending all the encoded key event data to a C# programme that does the rest.
I've noticed that although LUAMacros handles the KeyUp and KeyDown events when lmc_set_handler is suitable applied, it can do nothing to hide the state of a held key- for example, if you hold Ctrl on the 2nd (handled) keyboard and press V on the main (unhandled) keyboard, it is seen by the computer as a Ctrl + V combination. In an attempt to subdue this, I had the idea of sending a KeyUp event in my C# programme, which would get immediately handled by the same, thus triggering the virtual key in question to be marked as having been released.
In order to take care of the edge case in which the corresponding key of the main keyboard is simultaneously held (and thus I don't want to send a keyUp event), I was hoping to use LUAMacros to find out if the key is down on the main keyboard. Is there a function for getting the state of a key on a particular keyboard in LUAMacros?
Check key state?
Re: Check key state?
No, there's not. Keyboard handling is event based so you can't check current state in windows api.
Petr Medek
LUAmacros author
LUAmacros author
Re: Check key state?
Thanks for the quick reply!
I guess I'll just handle the main keyboard events (simulating the actual key event) and make a virtual keyboard to reference. Sadly I've run into difficulties with the C# side of things. It turns out Windows isn't easily fooled.
I guess I'll just handle the main keyboard events (simulating the actual key event) and make a virtual keyboard to reference. Sadly I've run into difficulties with the C# side of things. It turns out Windows isn't easily fooled.