Reputation: 1969
How can I detect LWin
and RWin
keys with hot key?
Right now I'm using the example code given here but it only detect the win key if its used as a modifier. I want to know how to detect the win key. Something like this:
private void textBox1_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.LWin || e.KeyCode == Keys.RWin)
WriteLine("Windows key pressed");
}
But with the ability of detecting it if the form is not focused.
Upvotes: 2
Views: 2853
Reputation: 1969
I found my answer in this question: C# : Keyboard Hook
Processing Global Mouse and Keyboard Hooks in C#.
I found that article quite useful.
Note: that credits goes to Kendall Frey for answering that SO question.
Upvotes: 1