From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Capture keystrokes while VI running in the background.

Hi

I have a VI that needs to run in the background, however I need it to be able to recognize a certain string when typed in on the keyboard, actually it's a barcode reader - same difference. I have tried to use the keyboard.zip file from the ftp site however the VI's don't seem to work unless they are in focus. How do I do this with the program running in the background??

Thanks

Jacob Thastrup
BioImage A/S
www.BioImage.dk
0 Kudos
Message 1 of 4
(2,890 Views)
Jacob,

What you are trying to do is not as easy as you think. Luckily if you are using Windows, there is a way to do this. The keyboard sends its info to the focused control on the focused window by means of the operating system. With windows there is a way to snoop the messages the OS is sending to an app. I don't know if this is exactly what you need, but take a look at this link :

http://zone.ni.com/devzone/devzoneweb.nsf/opendoc?openagent&F81544D8F66360308625683A000CB6A7&cat=2212A1CF726BE56C862567AC00583B8C

Hope this helps,
Jared
0 Kudos
Message 2 of 4
(2,890 Views)
Thank you for your fast reply. However as far as I could get it to work it still required me to have a VI in focus. The program running in front is not a Labview VI so I'm still stuck any other suggestions?

Thanks

Jacob Thastrup
0 Kudos
Message 3 of 4
(2,890 Views)
Jacob,

Get the VI called Get Keys.vi (or something alike) from our online (free)
library, www.air.nl. Maybe it needs some small modifications, but it should
do the job.

However, barcode scanners are not exactly the same as user input. In theory,
yes, in practice, no. Problem is they are very fast. So, you have to scan
the keyboard very fast. Probably too fast (e.g. it's not possible to obtain
all characters from the scanner).

Fortunatlly barcode scanners often have possibilities to add a delay between
characters. Set to a delay of 50 ms (or experiment, until perfect..) and it
should work.

The VI gets keys even if another application is active.

Regards,

Wiebe Walstra.

--
AIR technical Automation
www.air.nl
"jact" wrote in messa
ge
news:506500000005000000281E0000-984882144000@quiq.com...
Thank you for your fast reply. However as far as I could get it to
work it still required me to have a VI in focus. The program running
in front is not a Labview VI so I'm still stuck any other suggestions?

Thanks

Jacob Thastrup
0 Kudos
Message 4 of 4
(2,890 Views)