Anatolii Humennyi
Anatolii Humennyi

Reputation: 1856

C# detect pressing Windows key

I create a text box for entering a combination of global hot keys, which can then be used in the program. For this purpose I use event TextBox.KeyDown and look the KeyEventArgs. But the problem is that I have not found how to use the KeyEventArgs to see whether the Windows-key is pressed. Properties KeyCode, Modifiers use enum type Keys, which has no value for the Windows-key, because when you press the Windows-key, then KeyDown event is triggered, but the Modifiers property contains None.

What to do?

Upvotes: 1

Views: 650

Answers (2)

JBB
JBB

Reputation: 667

Try Keys.LWin and Keys.RWin for the keycode enum

Upvotes: 2

pbondoer
pbondoer

Reputation: 568

I suggest you try with Keys.LWin.

Upvotes: 2

Related Questions