my code is:
protected override bool ProcessCmdKey(ref System.Windows.Forms.Message msg, System.Windows.Forms.Keys keyData)
{
if (keyData == (Keys.LWin | Keys.M))
{
MessageBox.Show("LWin M");
return true;
}
return base.ProcessCmdKey(ref msg, keyData);
}
private void Form1_Load(object sender, EventArgs e)
{
this.FormBorderStyle = FormBorderStyle.None;
}
but the MessageBox.Show("LWin M");
never work,who can help me?thanks
update
the
MessageBos.Show("LWin M");
just for test ,the real code is:
this.WindowState = FormWindowState.Minimized;
This doesn't have anything to do with the FormBorderStyle, your code doesn't work when you omit the Load event as well. The Win + M shortcut keystroke is used by Windows before it sends it to a program. You can easily tell what it does, it minimizes the active window.
Never use the Windows key for your own shortcuts, you'll need to stick with Ctrl, Alt and Shift. Even using unassigned shortcuts is a Bad Idea, that will break in the next Windows version.