LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I change window focus of "Acquire Input Data/KeyboardAcquire" function

I have built a simple terminal program which is part of an application I am writing. The terminal program uses the "Acquire Input Data" poly function to read the keys currently being pressed on the PC keyboard. The problem I am having is that when I open another application (ie dos shell) and start to type something, the keystrokes are picked up (and sent) in my application also.
 
Is there some way I can check if my app window has focus so that I can stop checking the keyboard when my app looses focus?
 
Thanks in advance,
 
Howard Spec
CMC Electronics
Ottawa, Canada 
0 Kudos
Message 1 of 4
(2,974 Views)

Normally, to do such an application, you would be better off using the event structure with the Key Down event instead of the input VIs. This will solve your problem, because you define the events only for your VI.
If you still want to keep working with the input VIs, the Front Panel Window>>Is Frontmost property seems to do the trick.

To learn more about LabVIEW, I suggest you try searching this site and google for LabVIEW tutorials. Here and here are a couple you can start with. You can also contact your local NI office and join one of their courses.
In addition, I suggest you read the LabVIEW style guide and the LabVIEW user manual (Help>>Search the LabVIEW Bookshelf).


___________________
Try to take over the world!
Message 2 of 4
(2,970 Views)

Thanks for the info. I have only started to use the event structure since we upgraded from version 6.0 to 7.1 a while back. This is definitly the best way to have done the terminal, but too much work to change now. I looked for the Front panel Window property but could not find it. Can you please zero me in a bit on the location of this property?

Thanks,

Howard Spec

CMC Electronics

Canada

0 Kudos
Message 3 of 4
(2,953 Views)
Here.
 

___________________
Try to take over the world!
Message 4 of 4
(2,947 Views)