C#屏蔽消息

 const int WM_SYSCOMMAND = 0x112;
        const int SC_CLOSE = 0xF060;
        const int SC_MINIMIZE = 0xF020;
        const int SC_MAXIMIZE = 0xF030;
        protected override void WndProc(ref Message m)
        {

            if (m.Msg==WM_SYSCOMMAND)
            {
                if (m.WParam.ToInt32()==SC_MINIMIZE)
                {
                    this.Close();
                }
            }
            base.WndProc(ref m);
        }
    }

posted @ 2013-04-15 09:06  Predator  阅读(200)  评论(0编辑  收藏  举报