Esempio n. 1
0
        public WebBroswerForm(string inputKeyword, string uaString, AutoBroswerForm _AutoBroswer, int expireTime)
        {
            InitializeComponent();

            m_uaString = uaString;
            InitialTabBrowser = new ExtendedWebBrowser()
            {
                Parent = Tabs.TabPages[0],
                Dock = DockStyle.Fill,
                ScriptErrorsSuppressed = true,
                Tag = Tabs.TabPages[0]
            };
            InitialTabBrowser.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(InitialTabBrowser_DocumentCompleted);
            //InitialTabBrowser.NewWindow2 += new EventHandler<NewWindow2EventArgs>(SourceBrowser_NewWindow2);

            //InitialTabBrowser.BeforeNewWindow += new EventHandler<WebBrowserExtendedNavigatingEventArgs>(InitialTabBrowser_BeforeNewWindow);

            timeDown.Interval = 100;
            timeDown.Tick += new EventHandler(timeDown_Tick);
            timeUp.Interval = 100;
            timeUp.Tick += new EventHandler(timeUp_Tick);

            expireTimer.Interval = expireTime;// 15 * 60 * millSeconds;//15minus
            expireTimer.Enabled = true;
            expireTimer.Tick += new EventHandler(expireTimer_Tick);
            expireTimer.Start();

            keyWord = inputKeyword;
            autoBroswerFrom = _AutoBroswer;
            initValue();
            //InitializeBrowserEvents(InitialTabBrowser);
            m_webPages.Add(InitialTabBrowser);
        }
Esempio n. 2
0
        public WebBroswerForm(string inputKeyword, string uaString, AutoBroswerForm _AutoBroswer, int expireTime)
        {
            InitializeComponent();

            m_uaString        = uaString;
            InitialTabBrowser = new ExtendedWebBrowser()
            {
                Parent = Tabs.TabPages[0],
                Dock   = DockStyle.Fill,
                ScriptErrorsSuppressed = true,
                Tag = Tabs.TabPages[0]
            };
            InitialTabBrowser.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(InitialTabBrowser_DocumentCompleted);
            //InitialTabBrowser.NewWindow2 += new EventHandler<NewWindow2EventArgs>(SourceBrowser_NewWindow2);

            //InitialTabBrowser.BeforeNewWindow += new EventHandler<WebBrowserExtendedNavigatingEventArgs>(InitialTabBrowser_BeforeNewWindow);

            timeDown.Interval = 100;
            timeDown.Tick    += new EventHandler(timeDown_Tick);
            timeUp.Interval   = 100;
            timeUp.Tick      += new EventHandler(timeUp_Tick);

            expireTimer.Interval = expireTime;// 15 * 60 * millSeconds;//15minus
            expireTimer.Enabled  = true;
            expireTimer.Tick    += new EventHandler(expireTimer_Tick);
            expireTimer.Start();

            keyWord         = inputKeyword;
            autoBroswerFrom = _AutoBroswer;
            initValue();
            //InitializeBrowserEvents(InitialTabBrowser);
            m_webPages.Add(InitialTabBrowser);
        }
Esempio n. 3
0
        private void RandMoveInClient(IntPtr wndHandle, int moveTime, Rectangle randMoveRect)
        {
            int           currentRandMoveTimes = 0;
            int           randMoveCount        = moveTime / randMoveInterval;
            IntPtr        handle       = wndHandle;
            StringBuilder className    = new StringBuilder(100);
            const UInt32  WM_MOUSEMOVE = 0x0200;

            while (className.ToString() != "Internet Explorer_Server") // your mileage may vary with this classname
            {
                handle = GetWindow(handle, 5);                         // 5 == child
                GetClassName(handle, className, className.Capacity);
            }

            while (currentRandMoveTimes <= randMoveCount)
            {
                int   randOffsetX = autoBroswerFrom.rndGenerator.Next(0, randMoveRect.Width);
                int   randOffsetY = autoBroswerFrom.rndGenerator.Next(0, randMoveRect.Height);
                Point clientPoint = new Point(randOffsetX + randMoveRect.Left, randOffsetY + randMoveRect.Top);

                int position = ((clientPoint.Y) << 16) | (clientPoint.X);
                AutoBroswerForm.PostMessage(handle, WM_MOUSEMOVE, (int)1, position);
                currentRandMoveTimes++;
                Thread.Sleep(randMoveInterval);
            }
        }
Esempio n. 4
0
        public SimulateTab(AutoBroswerForm.STKeyInfo _keyInfo, string uaString, AutoBroswerForm _AutoBroswer, int expireTime)
        {
            this.FormBorderStyle = FormBorderStyle.None;
            this.TopLevel = false;
            this.Size = _AutoBroswer.webBrowserPanel.Size;
            m_uaString = uaString;

            if (_AutoBroswer.webBrowserPanel.InvokeRequired)
            {
                _AutoBroswer.webBrowserPanel.BeginInvoke(new MethodInvoker(delegate
                {
                    this.Parent = _AutoBroswer.webBrowserPanel;

                }));
            }
            InitialTabBrowser = new ExtendedWebBrowser()
            {
                Parent = this,
                Dock = DockStyle.Fill,
                ScriptErrorsSuppressed = true,
                UserAgent = uaString
            };

            timeDown.Interval = 100;
            timeUp.Interval = 100;
            InitialTabBrowser.Visible = true;
            InitialTabBrowser.NavigateError += new AutoBroswer.ExtendedWebBrowser.WebBrowserNavigateErrorEventHandler(InitialTabBrowser_NavigateError);
            if (_keyInfo.isZTCClick())
            {
                timeDown.Tick += new EventHandler(timeDownZTC_Tick);
                timeUp.Tick += new EventHandler(timeUpZTC_Tick);
                InitialTabBrowser.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(InitialTabBrowser_ZTCDocumentCompleted);
            }
            else
            {
                timeDown.Tick += new EventHandler(timeDown_Tick);
                timeUp.Tick += new EventHandler(timeUp_Tick);
                InitialTabBrowser.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(InitialTabBrowser_DocumentCompleted);
            }
            InitialTabBrowser.ProgressChanged += new WebBrowserProgressChangedEventHandler(InitialTabBrowser_ProgressChangedForSomething);

            jobExpireTime = DateTime.Now.AddMilliseconds(expireTime);

            keyInfo = _keyInfo;
            autoBroswerFrom = _AutoBroswer;
            initValue();

            InitialTabBrowser.Navigate("http://www.taobao.com/");
            isOpenningURL = true;
            openURLExpireTime = DateTime.Now.AddMilliseconds(OPENURLTIMEOUT);

            moniterTimer.Tick += new EventHandler(TimerTick);
            moniterTimer.Interval = 1000;
            moniterTimer.Enabled = true;
            moniterTimer.Start();
            Application.DoEvents();
        }
Esempio n. 5
0
        private void ClickOnPointInClient(IntPtr wndHandle, Point clientPoint)
        {
            int position = ((clientPoint.Y) << 16) | (clientPoint.X);

            IntPtr        handle    = wndHandle;
            StringBuilder className = new StringBuilder(100);

            while (className.ToString() != "Internet Explorer_Server") // your mileage may vary with this classname
            {
                handle = GetWindow(handle, 5);                         // 5 == child
                GetClassName(handle, className, className.Capacity);
            }
            const UInt32 WM_LBUTTONDOWN = 0x0201;
            const UInt32 WM_LBUTTONUP   = 0x0202;
            const int    MK_LBUTTON     = 0x0001;

            // 模拟鼠标按下
            AutoBroswerForm.SendMessage(handle, WM_LBUTTONDOWN, MK_LBUTTON, position);
            AutoBroswerForm.SendMessage(handle, WM_LBUTTONUP, MK_LBUTTON, position);
        }