cancel
Showing results for 
Search instead for 
Did you mean: 

Disable the windows key?

SOLVED
Sable
Member
Solved!

Disable the windows key?

Hi,

 

How can I detect the when the user hits the Windows key?

The "Key Down" event doesn't detect this key.

 

- Sable

7 REPLIES 7
Darin.K
Trusted Enthusiast

Re: Disable the windows key?

Message contains a hyperlink

I'd try out WinKill

https://casey.io/winkill/

 

You can use the dll to attach and detach the hook which blocks the windows key.  (If I recall correctly, it blocks for all applications, not just the one you attach the blocker to).  

Sable
Member

Re: Disable the windows key?

Thank you Darin.K.

 

Can you show me how to do this with a .dll to attach and detach the hook?

 

I am also looking for a way to detect when the user hits the Windows key on the keyboard.

 

- Sable

Darin.K
Trusted Enthusiast

Re: Disable the windows key?

Message contains an image Message contains an attachment

Quick example to show the WinKill usage.  I have adapted the code a little to remove the name mangling and to post a user event back to LV.  The windows callback function does not provide for user data so I had to get ugly and use a dll global variable.  The idea is simple:  create the hook and the user event,  do stuff (while loop), then remove the hook after the application is done.  Note, this disables the Windows keys for other applications, although you can still detect the presses (left or right).

 

WinKillBD.png

 

Just unzip the attachment, open the VI and make sure it finds the dll parked next door in the same directory.

Sable
Member

Re: Disable the windows key?

Interesting.

Could you please help to save the vi in LabVIEW 2013?

Darin.K
Trusted Enthusiast
Solution

Re: Disable the windows key?

Message contains an attachment

Added LV2013 version to the zip archive.

Sable
Member

Re: Disable the windows key?

Thank you very much Darin.K.

RavensFan
Knight of NI

Re: Disable the windows key?

You should mark Darin's post as the solution.  Not your own thank you message.