html5中文学习网

您的位置: 首页 > 网络编程 > ASP.NET » 正文

除了使用hook外,下面的代码也能够在全局捕捉鼠标:(csdn)_.NET教程_编程技术

[ ] 已经帮助:人解决问题
 dy_2000_abc(芝麻开门)  
public class Form1 : System.Windows.Forms.Form,IMessageFilter
    {
        private System.Windows.Forms.Button button1;
        static void Main()
        {
            Application.Run(new Form1());
        }

        private void Form1_Load(object sender, System.EventArgs e)
        {
        Application.AddMessageFilter(this);
        }
        public bool PreFilterMessage(ref Message msg)
        {
            if (msg.Msg==0x205)
            {
                this.button1.Visible=true;
                return true;
            }
            else
                if (msg.Msg==0x201)
            {
            this.button1.Visible=false;
                return true;
            }
            else
                return false;
        }
    }
}
  




zKaHTML5中文学习网 - HTML5先行者学习网
zKaHTML5中文学习网 - HTML5先行者学习网
(责任编辑:)
推荐书籍
推荐资讯
关于HTML5先行者 - 联系我们 - 广告服务 - 友情链接 - 网站地图 - 版权声明 - 人才招聘 - 帮助