winform 怎么 响应窗口的WM_MOUSEACTIVATE消息,返回MA_NOACTIVATE
winform 怎么 响应窗口的WM_MOUSEACTIVATE消息,返回MA_NOACTIVATE
本人新手。求简单明了的代码实列。代码。代码。谢谢各位大虾..
------解决方案--------------------
//截获系统关机消息
private const int WM_QUERYENDSESSION = 0x0011;
protected override void WndProc(ref Message m)
{
switch (m.Msg)
{
case WM_QUERYENDSESSION:
this.FormClosing -= new System.Windows.Forms.FormClosingEventHandler(this.frmMain_FormClosing);
Application.Exit();
base.WndProc(ref m);
break;
default:
base.WndProc(ref m);
break;
}
}
参数改一下。
------解决方案-------------------- protected override void WndProc(ref Message m)
{
if (m.Msg == WM_MOUSEACTIVATE)
{
doyoufunction(); //执行你需要的操作.
m.Msg = MA_NOACTIVATE;
}
base.WndProc(ref m);
}