写了个小的程序,基本上是:
1、注册键盘中的‘↑’触发关闭Form窗口;
Win32.RegisterHotKey(handle, (int)HotKeyID.CloseForm, (uint)KeyModifiers.None, Keys.Up);
2、在Form中拦截该消息
protected override void WndProc(ref System.Windows.Forms.Message e)
{
if(e.Msg == 0x0312)
{
if((LockHotKey.HotKeyID)m.WParam == HotKeyID.CloseForm)
{
this.Close();
}
}
base.WndProc(ref e);
}