先用webbrowser加载某网页,这时我的鼠标在上面移动,可不做到让webbrowser接受不到我的鼠标位吗?

解决方案 »

  1.   

    重写WebBrowser控件,屏蔽鼠标消息.
      

  2.   

    我试过了 不行 我将代码放上来 看看是不是我哪里错了public class NewBrowser : WebBrowser
    {
        protected override void WndProc(ref Message m)
        {
            if (m.Msg == 0x200)//WM_MOUSEMOVE
            {
                return;
            }            base.WndProc(ref m);
            }
    }
      

  3.   


    我通过给程序添加消息过滤器方法试图让WebBrowser收不到鼠标消息,也不起作用。楼主这样做是为了满足软件的什么功能?说一下好让我想想有没有其它变通方法。
        static class Program
        {
            /// <summary>
            /// The main entry point for the application.
            /// </summary>
            [STAThread]
            static void Main()
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.AddMessageFilter(new MyMessager());
                Application.Run(new MailSender());
            }
        }    internal class MyMessager : IMessageFilter
        {
            const int WM_MOUSEMOVE = 0x0200;        public bool PreFilterMessage(ref Message m)
            {
                switch (m.Msg)
                {
                    case WM_MOUSEMOVE:
                        return true;
                    default:
                        return false;
       
                }
             }
        }//end class
      

  4.   

    这个我要说明还真有点难度 和自动点击网页的flash有关的 我的自动点击网页代码执行时总是受到我的鼠标移动影响,使得自动点击失败,所以我让webbrowser接受不到外界的鼠标消息,这样就可以执行我的代码了
      

  5.   

    貌似和我近段写的一个程序类似,但我采用的方法是“抓图”,webbrowser在超出窗体的位置运行,在webrowser载入页面完成后,抓图给pictureBox控件进行显示,而调用windows API PostMessage发送点击给webbrowser内网页仍然是有效的,同时pictureBox可以进行页面显示的缩放。