LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Capturing Key press when the focus is not on VI. (event is not working).

Solved!
Go to solution

I have a VI, and found similar in Forums. I need to catch key down event, when the focus is not on VI.

I attached the VI found in forum. Try to click on other window, for example on block diagram of VI, when VI is running and check if it works. The answer is no, it doesn't work. When you press any key, the led button must change it's state, but it does only when the focus is on VI's front panel. The question is how to control key press, when VI is minimized or inactive. Is it possible to catch key down or any similar event, when the focus is on any other application, not on VI?

0 Kudos
Message 1 of 11
(6,203 Views)
Solution
Accepted by topic author Vision_Armenia

Have a look at the "Connectivity...input devices..." menu.

 

For an example, open the example finder and look for "basic input demo". It should give you some ideas. Good luck! 🙂

Message 2 of 11
(6,190 Views)
Also make sure to only use this in a controlled environment with full disclosure to the user. It would be easy to abuse this as a keylogger to e.g. capture passwords entered by the user into web forms, etc.. This might get you in serious legal trouble.
Message 3 of 11
(6,182 Views)

Thanks for the help altenbach.

It is really working with directly acquiring from input devices. So the issue is solved. And there is no need to use event structure for it as it was in my example VI.

Just as a question, is it possible to do the same using event structure? I found some ways for dynamic registration of key down event, but couldn't make it work.

Anyway now I can do what I want.

 

Finally I want to inform that it is not keylogger, I am using it to wrote a program for disabled people - moving mouse or clicking keys via face moving using camera.

Message 4 of 11
(6,149 Views)

@Vision_Armenia wrote:

I have a VI, and found similar in Forums. I need to catch key down event, when the focus is not on VI.

I attached the VI found in forum. Try to click on other window, for example on block diagram of VI, when VI is running and check if it works. The answer is no, it doesn't work. When you press any key, the led button must change it's state, but it does only when the focus is on VI's front panel. The question is how to control key press, when VI is minimized or inactive. Is it possible to catch key down or any similar event, when the focus is on any other application, not on VI?So 


So, I have created a keylogger that records the keystrokes even when the focus is outside the LabVIEW window (LoL). Please use this VI for an Educational PurposeSmiley Surprised. This VI will save the keystrokes it in a text file format.

 

Hope it Helps! 

 

LabVIEW for all ; All for LabVIEW


Message 5 of 11
(3,581 Views)

Hi Muthu,

 

have you heard about the "Format Date/Time String" function? It would improve your VI:

check.png

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 11
(3,572 Views)

@GerdW wrote:

Hi Muthu,

 

have you heard about the "Format Date/Time String" function? It would improve your VI:

check.png

 


Gerd, check the timestamps on the OP 🙂 

 

This is a zombie thread started a decade ago and marked solved 5 yes ago.  Not really a hot topic anymore 

 

Still, the scan to string on the string pallet seams a little more robust than the format date time string on the timing palette. 


"Should be" isn't "Is" -Jay
0 Kudos
Message 7 of 11
(3,567 Views)

Hi Jeff,

 

I knew about the 10 year old thread…

 

Still, the scan to string on the string pallet seams a little more robust than the format date time string on the timing palette.

Why should FormatIntoString be more "robust" than FormatDateTimeString? They use the same (time) format codes. (One difference: FormatDateTimeString doesn't support the additional %<>T, %<>t or %^<>T of FormatIntoString…)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 11
(3,562 Views)

@GerdW wrote:

Hi Muthu,

 

have you heard about the "Format Date/Time String" function? It would improve your VI:

check.png

 


Hi Gerd,

            Thanks for your Prompt replyHeart, i have modified the code so it now has "Fomat Date/Time String". But there appears to be some issue with the code, The while loops scans keystrokes for every 60ms (some weird constant value that came to my mindSmiley Sad). so some repeated data is getting Logged as well. Could you help me with that?

0 Kudos
Message 9 of 11
(3,511 Views)

Hi Muthu,

 

so some repeated data is getting Logged as well. Could you help me with that?

No, I cannot.

I think that is a problem of those polling KeyboardInput functions…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 10 of 11
(3,499 Views)