03-23-2020 12:09 AM
I'd like to get keyboard events (key up, key down) even when the front panel isn't active (for example if it's minimized or if another window pops up and steals focus). I saw one thread and the suggestion was to use Acquire Input Data. That seems viable but I'd rather not poll if I didn't have to. I also saw a suggestion to use the Windows Message Queue Library but it looks like it might be broken in LV64.
Any other suggestions?
03-23-2020 01:06 AM
Only the active window gets notified by OS.
03-23-2020 04:53 AM
@nanocyte wrote:
I also saw a suggestion to use the Windows Message Queue Library but it looks like it might be broken in LV64.
That shouldn't be hard to fix though. Replacing all 32 bit pointers with pointer sized integers should do the trick. With a little care it should work for 32 bit and 64 bit.
But if you're going to hook a window, you might still not get events if it's not active. I didn't catch up with recent versions on this. LabVIEW used to have one handler for all windows.
03-23-2020 10:28 AM - edited 03-23-2020 10:30 AM
@zou wrote:
Only the active window gets notified by OS.
You're saying Windows Message Queue Library won't work? Oh, I hope I don't have to hook into a driver.
03-23-2020 10:53 AM
> But if you're going to hook a window, you might still not get events if it's not active.
> I didn't catch up with recent versions on this. LabVIEW used to have one handler for
> all windows.
You have to implement a system wide hook, i.e. inject your hook dll into all processes, not just a window.
03-23-2020 11:09 AM
I believe it's meant to be hard. That's how you make keyloggers ...
/Y
03-23-2020 11:18 AM
@zou wrote:
> But if you're going to hook a window, you might still not get events if it's not active.
> I didn't catch up with recent versions on this. LabVIEW used to have one handler for
> all windows.
You have to implement a system wide hook, i.e. inject your hook dll into all processes, not just a window.
Not per se. There is a level between "system wide" and "when the window is not active". OP might want to monitor keystrokes in LabVIEW, while the VI that monitors is not active.
In fact, if that is the case, (s)he can do so with normal LabVIEW events by dynamically registering for other VI's events.
Guess OP has some explaining to do.
03-23-2020 11:29 AM
Apparently, you can register a systemwide hot key: registerhotkey (MSDN). But that only catches one key, and you'll get a window message as a result. So you'd still need to hook the window handler.
It's all about details, but polling looks pretty good compared to hooking messages. Globally or not.
03-23-2020 01:08 PM
@Yamaeda wrote:
I believe it's meant to be hard. That's how you make keyloggers ...
/Y
That makes no sense. I can always just poll for your keys with Acquire Input Data so I don't think this is "hard" per se. It's really just a matter of implementation at this point.
03-23-2020 01:13 PM
Not per se. There is a level between "system wide" and "when the window is not active". OP might want to monitor keystrokes in LabVIEW, while the VI that monitors is not active.
In fact, if that is the case, (s)he can do so with normal LabVIEW events by dynamically registering for other VI's events.
Guess OP has some explaining to do.
When the user presses an arrow key I want to start an action and then when they lift up off the arrow key I want to stop that action. There's an issue right now where if another window pops up while the user is pressing the arrow, LV doesn't get the key down event and the action continues indefinitely.