LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Capture Global Keyboard Events

HI,

 

I'm looking to use Labview to capture a keyboard event directed to another application to trigger an output of a DAQ device.  This requires the other application to have focus and the labview app to be in background.

 

I think that using the 'SetWindowsHookEx' function from user32.dll might work?  Has anyone used this function in LV before?  Or is there another way to capture global keyboard events?  Thanks.

 

-Joe

0 Kudos
Message 1 of 5
(3,065 Views)

It's not easy to use the hook function.

Alternatively, you can use the Input Device Control VIs (on the function palette, Connectivity => Input Device Control palette).

 

 

George Zou
0 Kudos
Message 2 of 5
(3,052 Views)

You may also find this community example useful: https://decibel.ni.com/content/docs/DOC-13648

 

Regards,

Brice Sorrells

Systems Engineer

National Instruments

www.ni.com/support

0 Kudos
Message 3 of 5
(3,023 Views)

Thanks for the ideas.  I will probably go with the Device Control VIs.  I don't think I've ever used them before; it appears that you have to poll the output (as opposed to using events)?  Thanks.

 

-Joe

 

0 Kudos
Message 4 of 5
(2,996 Views)

That's right.   You have to poll.  But it's a lot easier to code, and DEBUG!

 

George Zou
0 Kudos
Message 5 of 5
(2,993 Views)