Windows key - LWin

A

AntoineKrige

Hi,

I have the following windows form code to trap the 'key press' of the
windows key (LWin). How do I stop the key event from being processed?
I'm trying to block the use of the LWin key...

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace TestApp
{
public partial class Test : Form
{
public Test()
{
InitializeComponent();
}

protected override bool ProcessCmdKey(ref
System.Windows.Forms.Message msg, System.Windows.Forms.Keys KeyData)
{
if (KeyData == Keys.LWin)
{
MessageBox.Show("LWin");
}
else
{
MessageBox.Show("Key=" + KeyData.ToString());
}
return true;
}
}
}
 
G

Guest

Hi,

I have the following windows form code to trap the 'key press' of the
windows key (LWin). How do I stop the key event from being processed?
I'm trying to block the use of the LWin key...

The LWin key is processed by Windows at the operating system level. The
Control.ProcessCmdKey method that you are using will only monitor for
keypresses at the form level, after the key has already been passed to your
application by the operating system. Anything you do at this point is
already "too late". The only way to suppress the LWin key is to use a global
keyboard hook.

We offer a .NET component FREE for non-commercial use that will enable you
to monitor and suppress the LWin key:

http://www.mini-tools.com/goto/input
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top