3
我已经定义了一个HotKey
Ctrl +空格来激活我的Windows窗体。当表格处理这个HotKey
时,系统看不到这个事件。随后有什么方法可以解开这些击键? (也就是说,注销HotKey
)不处理(取消注册)系统范围的“热键”
这是我曾尝试:
private int tuyen_HotKey_Active = 1208132019;
private void Reg_HotKey(bool mode)
{
if (mode)
{
RegisterHotKey(this.Handle, tuyen_HotKey_Active, 2, 32); // Ctrl + Space
}
else
{
UnregisterHotKey(this.Handle, tuyen_HotKey_Active);
}
}
protected override void WndProc(ref Message m)
{
if (m.Msg == 0x0312) if(m.WParam.ToInt32() == tuyen_HotKey_Active)
{
// Do something here. I want Ctrl + Space keystroke to be
// unhandled here so that it can be seen by the system.
}
base.WndProc(ref m);
}
这是没有道理的。如果你尝试做这个工作,那么你最终会再次触发WM_HOTKEY消息。这将不会顺利。 – 2012-08-13 13:48:59