상속: System.Windows.Forms.Control, IOleClientSite, IOleInPlaceSite, IDocHostShowUI, IDocHostUIHandler, DWebBrowserEvents2, IfacesEnumsStructsClasses.IDropTarget, IfacesEnumsStructsClasses.IServiceProvider, IHttpSecurity, IWindowForBindingUI, INewWindowManager, IAuthenticate, IOleCommandTarget, IInternetSecurityManager, IHTMLEventCallBack, IProtectFocus, IHTMLOMWindowServices
예제 #1
0
        static void Main(string[] args)
        {
            //init browser
            csExWB.cEXWB pWb = new cEXWB();
            pWb.Size = new System.Drawing.Size(800, 600);
            pWb.WBDOCDOWNLOADCTLFLAG = (int)
                (DOCDOWNLOADCTLFLAG.NO_SCRIPTS |
                 DOCDOWNLOADCTLFLAG.NO_DLACTIVEXCTLS |
                 DOCDOWNLOADCTLFLAG.NO_JAVA |
                 DOCDOWNLOADCTLFLAG.NO_RUNACTIVEXCTLS |
                 DOCDOWNLOADCTLFLAG.PRAGMA_NO_CACHE |
                 DOCDOWNLOADCTLFLAG.SILENT);
            pWb.DownloadSounds = false;
            pWb.DownloadVideo = false;

            pWb.DocumentComplete += new DocumentCompleteEventHandler(pWb_DocumentComplete);
            pWb.NavigateError += new NavigateErrorEventHandler(pWb_NavigateError);
            pWb.WBSecurityProblem += new SecurityProblemEventHandler(pWb_WBSecurityProblem);
            pWb.BeforeNavigate2 += new BeforeNavigate2EventHandler(pWb_BeforeNavigate2);

            pWb.NavToBlank();

            pWb.Navigate("http://www.google.com");
            while (!done)
            {
                Application.DoEvents();
                System.Threading.Thread.Sleep(100);
            }

            //Get the source, the document, ....
        }
예제 #2
0
 protected csExWB.cEXWB GetWebBrowser()
 {
     if (pWB == null)
     {
         pWB = CWBPool.RentCWB();
         RegiserHandler();                
         return pWB;
     }
     else
         return pWB;
 }
예제 #3
0
 public virtual void Reset()
 {
     if (pWB != null)
     {
         UnregiserHandler();
         CWBPool.ReturnCWB(pWB);
         pWB = null;
     }
     pNode      = null;
     pNodesEnum = null;
     pNodeList  = null;
     m_NodeStack.Clear();
 }
예제 #4
0
 protected csExWB.cEXWB GetWebBrowser()
 {
     if (pWB == null)
     {
         pWB = CWBPool.RentCWB();
         RegiserHandler();
         return(pWB);
     }
     else
     {
         return(pWB);
     }
 }
예제 #5
0
 protected void Dispose(bool Disposing)
 {
     if (!IsDisposed)
     {
         if (Disposing)
         {
             //清理托管资源
         }
         //清理非托管资源
         if (pWB != null)
         {
             UnregiserHandler();
             CWBPool.ReturnCWB(pWB);
             pWB = null;
         }
     }
     IsDisposed = true;
 }
예제 #6
0
        private void InitWebBrower()
        {
            WebBrower=new cEXWB();

            this.WebBrower.Border3DEnabled = false;
            //this.WebBrower.DocumentSource = "<HTML><HEAD></HEAD>\r\n<BODY></BODY></HTML>";
            this.WebBrower.DocumentTitle = "";
            //this.WebBrower.DownloadActiveX = false;
            //this.WebBrower.DownloadFrames = true;
            //this.WebBrower.DownloadImages = true;
            //this.WebBrower.DownloadJava = true;
            //this.WebBrower.DownloadScripts = true;
            //this.WebBrower.DownloadSounds = false;
            //this.WebBrower.DownloadVideo = false;
            this.WebBrower.FileDownloadDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + System.IO.Path.DirectorySeparatorChar.ToString();
            this.WebBrower.Location = new Point(5, 38);
            this.WebBrower.LocationUrl = "about:blank";
            this.WebBrower.Name = "WebBrower";
            this.WebBrower.ObjectForScripting = null;
            this.WebBrower.OffLine = false;
            this.WebBrower.RegisterAsBrowser = true;
            this.WebBrower.RegisterAsDropTarget = false;
            this.WebBrower.RegisterForInternalDragDrop = true;
            this.WebBrower.ScrollBarsEnabled = true;
            this.WebBrower.SendSourceOnDocumentCompleteWBEx = false;
            this.WebBrower.Silent = false;
            this.WebBrower.Size = new Size(749, 449);
            this.WebBrower.TabIndex = 0;
            this.WebBrower.Text = "WebBrower";
            this.WebBrower.TextSize = IfacesEnumsStructsClasses.TextSizeWB.Medium;
            this.WebBrower.UseInternalDownloadManager = true;
            this.WebBrower.WBDOCDOWNLOADCTLFLAG = 112;
            this.WebBrower.WBDOCHOSTUIDBLCLK = IfacesEnumsStructsClasses.DOCHOSTUIDBLCLK.DEFAULT;
            this.WebBrower.WBDOCHOSTUIFLAG = 262276;
            this.WebBrower.Anchor = AnchorStyles.Left | AnchorStyles.Right|AnchorStyles.Top|AnchorStyles.Bottom;
            this.WebBrower.Dock = DockStyle.Fill;
            this.WebBrower.NavToBlank();
            this.WebBrower.Navigate("http://finance.qq.com/a/20121223/000025.htm?pgv_ref=aio2012&ptlang=2052");
        }
        /// <summary>
        /// 解除浏览器绑定的事件
        /// </summary>
        /// <param name="wb"></param>
        private void UnregiserWebBrowerHandler(cEXWB wb)
        {
            if (wb != null)
            {
                //注销事件处理方法
                wb.ProtocolHandlerBeginTransaction -= new ProtocolHandlerBeginTransactionEventHandler(WebBrower_ProtocolHandlerBeginTransaction);
                wb.ProtocolHandlerOnResponse -= new ProtocolHandlerOnResponseEventHandler(WebBrower_ProtocolHandlerOnResponse);
                wb.ProtocolHandlerDataFullyAvailable -= new ProtocolHandlerDataFullyAvailableEventHandler(WebBrower_ProtocolHandlerDataFullyAvailable);
                wb.ProtocolHandlerDataFullyRead -= new ProtocolHandlerDataFullyReadEventHandler(WebBrower_ProtocolHandlerDataFullyRead);
                wb.ProtocolHandlerOperationFailed -= new ProtocolHandlerOperationFailedEventHandler(WebBrower_ProtocolHandlerOperationFailed);

                wb.ScriptError -= new ScriptErrorEventHandler(WebBrower_ScriptError);
                wb.WBOnDocumentChanged -= new EventHandler(WebBrower_WBOnDocumentChanged);

                wb.DocumentComplete -= new DocumentCompleteEventHandler(WebBrower_DocumentComplete);
                wb.NavigateError -= new NavigateErrorEventHandler(WebBrower_NavigateError);
                wb.WBSecurityProblem -= new SecurityProblemEventHandler(WebBrower_WBSecurityProblem);
                //wb.BeforeNavigate2 -= new BeforeNavigate2EventHandler(VBACsEXWB_BeforeNavigate2);
                wb.WBDocHostShowUIShowMessage -= new DocHostShowUIShowMessageEventHandler(WebBrower_WBDocHostShowUIShowMessage);
                wb.ProcessUrlAction -= new ProcessUrlActionEventHandler(WebBrower_ProcessUrlAction);
                //wb.WBEvaluteNewWindow -= new EvaluateNewWindowEventHandler(WebBrower_WBEvaluteNewWindow);
            }
        }
예제 #8
0
        private bool AddNewBrowser(string TabText, string TabTooltip, string Url, bool BringToFront)
        {
            //Copy flags
            int iDochostUIFlag = (int)(DOCHOSTUIFLAG.NO3DBORDER |
                        DOCHOSTUIFLAG.FLAT_SCROLLBAR | DOCHOSTUIFLAG.THEME);
            int iDocDlCltFlag = (int)(DOCDOWNLOADCTLFLAG.DLIMAGES |
                        DOCDOWNLOADCTLFLAG.BGSOUNDS | DOCDOWNLOADCTLFLAG.VIDEOS);

            //if (WebBrower != null)
            //{
            //    iDochostUIFlag = WebBrower.WBDOCHOSTUIFLAG;
            //    iDocDlCltFlag = WebBrower.WBDOCDOWNLOADCTLFLAG;
            //}

            csExWB.cEXWB pWB = null;

            try
            {

                //Create and setup browser
                pWB = new csExWB.cEXWB();

                //pWB.Dock = cEXWB1.Dock;
                pWB.Anchor = WebBrower.Anchor;

                pWB.Location = WebBrower.Location;
                pWB.Size = WebBrower.Size;
                //pWB.Name = System.Guid.NewGuid().ToString();
                pWB.RegisterAsBrowser = true;
                pWB.WBDOCDOWNLOADCTLFLAG = iDocDlCltFlag;
                pWB.WBDOCHOSTUIFLAG = iDochostUIFlag;
                //pWB.FileDownloadDirectory = WebBrower.FileDownloadDirectory;
                //pWB.DownloadActiveX = false;
                //pWB.DownloadFrames = true;
                //pWB.DownloadImages = true;
                //pWB.DownloadJava = true;
                //pWB.DownloadScripts = true;
                //pWB.DownloadSounds = false;
                //pWB.DownloadVideo = false;

                pWB.RegisterAsBrowser = true;
                this.RegisterEvent(pWB);

                //Add to controls collection
                //this.Controls.Add(pWB);
                BrowerPannel.Controls.Add(pWB);

                if (BringToFront)
                {
                    //Bring to front
                    pWB.BringToFront();
                }
                //Increase count
                WebBrower = pWB;
            }
            catch (Exception ee)
            {
                return false;
            }

            return true;
        }
        /// <summary>
        /// 浏览器组件事件绑定
        /// </summary>
        /// <param name="wb"></param>
        private void RegiserWebBrowerHandler(cEXWB wb)
        {
            if (wb != null)
            {
                //注册事件处理方法
                wb.ProtocolHandlerBeginTransaction += new ProtocolHandlerBeginTransactionEventHandler(WebBrower_ProtocolHandlerBeginTransaction);
                wb.ProtocolHandlerOnResponse += new ProtocolHandlerOnResponseEventHandler(WebBrower_ProtocolHandlerOnResponse);
                wb.ProtocolHandlerDataFullyAvailable += new ProtocolHandlerDataFullyAvailableEventHandler(WebBrower_ProtocolHandlerDataFullyAvailable);
                wb.ProtocolHandlerDataFullyRead += new ProtocolHandlerDataFullyReadEventHandler(WebBrower_ProtocolHandlerDataFullyRead);
                wb.ProtocolHandlerOperationFailed += new ProtocolHandlerOperationFailedEventHandler(WebBrower_ProtocolHandlerOperationFailed);

                wb.ScriptError += new ScriptErrorEventHandler(WebBrower_ScriptError);
                wb.WBOnDocumentChanged += new EventHandler(WebBrower_WBOnDocumentChanged);
                wb.DocumentComplete += new DocumentCompleteEventHandler(WebBrower_DocumentComplete);
                wb.NavigateError += new NavigateErrorEventHandler(WebBrower_NavigateError);
                wb.WBSecurityProblem += new SecurityProblemEventHandler(WebBrower_WBSecurityProblem);
                //wb.BeforeNavigate2 += new BeforeNavigate2EventHandler(VBACsEXWB_BeforeNavigate2);
                wb.WBDocHostShowUIShowMessage += new DocHostShowUIShowMessageEventHandler(WebBrower_WBDocHostShowUIShowMessage);
                wb.ProcessUrlAction += new ProcessUrlActionEventHandler(WebBrower_ProcessUrlAction);
                //wb.WBEvaluteNewWindow += new EvaluateNewWindowEventHandler(WebBrower_WBEvaluteNewWindow);
                wb.NewWindow2 += new NewWindow2EventHandler(WebBrower_NewWindow2);
                //wb.FileDownloadExStart += new FileDownloadExEventHandler(WebBrower_FileDownloadExStart);
            }
        }
 /// <summary>
 /// 初始化浏览器组件
 /// </summary>
 /// <param name="wb"></param>
 private void SetupWebBrower(cEXWB wb)
 {
     //wb.WBDOCDOWNLOADCTLFLAG = (int)(
     //    DOCDOWNLOADCTLFLAG.NO_SCRIPTS |
     //    DOCDOWNLOADCTLFLAG.NO_DLACTIVEXCTLS |
     //    DOCDOWNLOADCTLFLAG.NO_JAVA |
     //    DOCDOWNLOADCTLFLAG.NO_RUNACTIVEXCTLS |
     //    DOCDOWNLOADCTLFLAG.PRAGMA_NO_CACHE |
     //    DOCDOWNLOADCTLFLAG.SILENT);
     wb.DownloadSounds = false;
     wb.DownloadVideo = false;
     wb.DownloadActiveX = false;
     wb.DownloadFrames = false;
     wb.DownloadImages = false;
     wb.DownloadScripts = true;
     wb.Border3DEnabled = false;
     wb.ScrollBarsEnabled = false;
     wb.Silent = false;//whether the Webbrowser control can show dialog boxes
     //wb.FileDownloadDirectory = "C:\\Documents and Settings\\Mike\\My Documents\\";
     wb.FileDownloadDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + System.IO.Path.DirectorySeparatorChar.ToString();
     //wb.UseInternalDownloadManager = true;
 }
 public void Clear(bool dispose)
 {
     if(dispose)
     {
         if (WB != null)
         {
             //解除事件绑定
             this.UnregiserWebBrowerHandler(WB);
             WB.Dispose();
             WB.Clear();
             WB.ClearHistory();
             WB.ClearSessionCookies();
             WB = null;
             //GC.Collect();
         }
     }
     else
     {
         Clear();
     }
 }
        public void Setup(cEXWB wb)
        {
            this.WB = wb;
            if (this.WB == null)
            {
                return;
            }

            this.SetupWebBrower(this.WB);
            this.RegiserWebBrowerHandler(this.WB);

            // need to initialize the webbrowser control by calling NavToBlank() at least once
            this.WB.NavToBlank();
            if (this.HttpRequestUrls == null)
            {
                this.HttpRequestUrls = new List<string>();
            }
        }
예제 #13
0
 private void RegisterEvent(cEXWB WebBrower)
 {
     WebBrower.DocumentComplete+=new DocumentCompleteEventHandler(WebBrower_DocumentComplete);
     WebBrower.WBLButtonDown += new csExWB.HTMLMouseEventHandler(WebBrower_WBLButtonDown);
     WebBrower.WBLButtonUp += new csExWB.HTMLMouseEventHandler(WebBrower_WBLButtonUp);
     WebBrower.NewWindow2+=new NewWindow2EventHandler(WebBrower_NewWindow2);
 }
예제 #14
0
 public static IHTMLDocument2 GetFunctionFrame(cEXWB browser)
 {
     return GetDocumentFromFrame(browser, "FunctionFrame");
 }
예제 #15
0
 public IEServerWindow(cEXWB wb)
 {
     this.browser = wb;
     SetupSubclassing();
 }
예제 #16
0
        protected void Dispose(bool Disposing)  
        {  
            if(!IsDisposed)  
            {
                if (Disposing)  
                {
                    //清理托管资源

                }  
                //清理非托管资源
                if (pWB != null)
                {
                    UnregiserHandler();
                    CWBPool.ReturnCWB(pWB);
                    pWB = null;
                }
            }  
            IsDisposed=true;  
        }
예제 #17
0
        public IEServerWindow(cEXWB wb)
        {
            this.browser = wb;

            if (!wb.IEServerHwnd.Equals(IntPtr.Zero))
            {
                AssignHandle(wb.IEServerHwnd);
            }
        }
예제 #18
0
        private void DoSomethingWithParameterV2(object x)
        {
            var parameter = x as SpiderParameter;
            if (parameter != null)
            {
                foreach (DataRow dr in parameter.DT.Rows)
                {
                    var rowId = Convert.ToInt32(dr["RowId"]);
                    var url = Convert.ToString(dr["Url"]);
                    var productId = Convert.ToString(dr["ProductId"]);

                    //lock(LockHelper)
                    //{
                        #region
                        //using (Control c = new Control())
                        //{

                        //    ExtendedWebBrowser wwb = new ExtendedWebBrowser();
                        //    wwb.ScriptErrorsSuppressed = true;
                        //    wwb.IsWebBrowserContextMenuEnabled = false;
                        //    wwb.AllowWebBrowserDrop = false;
                        //    wwb.ScrollBarsEnabled = false;
                        //    c.Controls.Add(wwb);

                        //    wwb.BusinessData = productId;
                        //    wwb.ThreadId = parameter.ThreadId;
                        //    //Loading[parameter.ThreadId] = true; // 表示正在加载
                        //    //wwb.DownloadComplete += new EventHandler(wwb_DownloadComplete);
                        //    //wwb.Navigated += wwb_Navigated;
                        //    wwb.NewWindow += wb_NewWindow;
                        //    wwb.DocumentCompleted += wwb_DocumentCompleted;

                        //    wwb.NavigateError += new ExtendedWebBrowser.WebBrowserNavigateErrorEventHandler(wb_NavigateError);
                        //    wwb.DownloadControlFlags = (int)WebBrowserDownloadControlFlags.DOWNLOADONLY;
                        //    wwb.Navigate(url);
                        //    //var tempLoading = Loading[parameter.ThreadId];
                        //    // !wwb.IsDisposed &&
                        //    while ( wwb.ReadyState != WebBrowserReadyState.Complete)
                        //    {
                        //        Application.DoEvents(); // 等待本次加载完毕才执行下次循环.
                        //    }
                        //    if (wwb.ActiveXInstance != null)
                        //    {
                        //        Marshal.ReleaseComObject(wwb.ActiveXInstance);
                        //    }

                        //    wwb.Dispose();
                        //    wwb = null;
                        //}
                        #endregion
                    using (csExWB.cEXWB pWb = new cEXWB())
                    {
                        //pWb.Size = new System.Drawing.Size(800, 600);
                        pWb.WBDOCDOWNLOADCTLFLAG = (int)
                            (DOCDOWNLOADCTLFLAG.NO_SCRIPTS |
                             DOCDOWNLOADCTLFLAG.NO_DLACTIVEXCTLS |
                             DOCDOWNLOADCTLFLAG.NO_JAVA |
                             DOCDOWNLOADCTLFLAG.NO_RUNACTIVEXCTLS |
                             DOCDOWNLOADCTLFLAG.PRAGMA_NO_CACHE |
                             DOCDOWNLOADCTLFLAG.SILENT);
                        pWb.DownloadSounds = false;
                        pWb.DownloadVideo = false;
                        pWb.DownloadActiveX = false;
                        pWb.DownloadImages = false;
                        pWb.DownloadScripts = true;

                        pWb.DocumentComplete += new DocumentCompleteEventHandler(pWb_DocumentComplete);
                        pWb.NavigateError += new NavigateErrorEventHandler(pWb_NavigateError);
                        pWb.WBSecurityProblem += new SecurityProblemEventHandler(pWb_WBSecurityProblem);
                        pWb.BeforeNavigate2 += new BeforeNavigate2EventHandler(pWb_BeforeNavigate2);
                        //pWb.DisableScriptDebugger();
                        pWb.NavToBlank();

                        pWb.Navigate(url);
                        while (!done)
                        {
                            Application.DoEvents();
                            System.Threading.Thread.Sleep(100);
                        }
                        GatherPriceV2(productId, url, pWb.DocumentSource);
                        //pWb.Dispose();
                        done = false;
                    }

                    //}
                }
            }
        }
예제 #19
0
        /// <summary>
        /// Attempts to return a List of IHTMLElements with the given Name or Id
        /// If document is frameset then all frames are searched
        /// </summary>
        /// <param name="NameOrId">Name or Id of the element</param>
        /// <returns></returns>
        public static List<IHTMLElement> GetElementsByNameOrId(cEXWB browser, string NameOrId)
        {
            List<IHTMLElement> elemCols = new List<IHTMLElement>();

            if ((browser == null) ||
                string.IsNullOrEmpty(NameOrId))
                return elemCols;

            IHTMLDocument2 doc2 = browser.WebbrowserObject.Document as IHTMLDocument2;
            if (doc2 == null)
                return elemCols;

            IHTMLElementCollection col = null;
            string elemname = string.Empty;
            if (browser.FramesCount() > 0)
            {
                List<IWebBrowser2> frames = browser.GetFrames();
                if (frames == null)
                    return elemCols;
                IHTMLDocument2 framedoc = null;

                foreach (IWebBrowser2 wb in frames)
                {
                    if (wb == null)
                        continue;
                    framedoc = wb.Document as IHTMLDocument2;
                    if (framedoc == null)
                        continue;
                    col = framedoc.all as IHTMLElementCollection;
                    if (col == null)
                        continue;
                    foreach (IHTMLElement elem in col)
                    {
                        if (elem != null)
                        {
                            elemname = elem.getAttribute("name", 0) as string;
                            if ((elem.id == NameOrId) ||
                                (elemname == NameOrId))
                            {
                                elemCols.Add(elem);
                            }
                        }
                    }
                }
            }
            else
            {
                col = doc2.all as IHTMLElementCollection;
                if (col == null)
                    return elemCols;
                foreach (IHTMLElement elem in col)
                {
                    if (elem != null)
                    {
                        elemname = elem.getAttribute("name", 0) as string;
                        if ((elem.id == NameOrId) ||
                            (elemname == NameOrId))
                        {
                            elemCols.Add(elem);
                        }
                    }
                }
            }

            return elemCols;
        }
예제 #20
0
        public static IHTMLDocument2 GetDocumentFromFrame(cEXWB browser, string frameName)
        {
            List<IWebBrowser2> frames = browser.GetFrames();
            foreach (IWebBrowser2 wb in frames)
            {
                IHTMLFrameBase elem = (IHTMLFrameBase)wb;
                if ((!string.IsNullOrEmpty(elem.name))
                    && (elem.name == frameName))
                {
                    IHTMLDocument2 doc = (IHTMLDocument2)wb.Document;
                    //string body = doc2.body.innerHTML;
                    return doc;
                }

            }
            return null;
        }
예제 #21
0
 public static IHTMLDocument2 GetNavigationFrame(cEXWB browser)
 {
     return GetDocumentFromFrame(browser, "Navigation");
 }
예제 #22
0
 public virtual void Reset()
 {            
     if (pWB != null)
     {
         UnregiserHandler();
         CWBPool.ReturnCWB(pWB);
         pWB = null;
     }
     pNode = null;
     pNodesEnum = null;
     pNodeList = null;
     m_NodeStack.Clear();
 }
예제 #23
0
        private bool AddNewBrowser(string TabText, string TabTooltip, string Url, bool BringToFront)
        {
            //Copy flags
            int iDochostUIFlag = (int)(DOCHOSTUIFLAG.NO3DBORDER |
                                       DOCHOSTUIFLAG.FLAT_SCROLLBAR | DOCHOSTUIFLAG.THEME);
            int iDocDlCltFlag = (int)(DOCDOWNLOADCTLFLAG.DLIMAGES |
                                      DOCDOWNLOADCTLFLAG.BGSOUNDS | DOCDOWNLOADCTLFLAG.VIDEOS);

            //if (WebBrower != null)
            //{
            //    iDochostUIFlag = WebBrower.WBDOCHOSTUIFLAG;
            //    iDocDlCltFlag = WebBrower.WBDOCDOWNLOADCTLFLAG;
            //}

            csExWB.cEXWB pWB = null;

            try
            {
                //Create and setup browser
                pWB = new csExWB.cEXWB();

                //pWB.Dock = cEXWB1.Dock;
                pWB.Anchor = WebBrower.Anchor;

                pWB.Location = WebBrower.Location;
                pWB.Size     = WebBrower.Size;
                //pWB.Name = System.Guid.NewGuid().ToString();
                pWB.RegisterAsBrowser    = true;
                pWB.WBDOCDOWNLOADCTLFLAG = iDocDlCltFlag;
                pWB.WBDOCHOSTUIFLAG      = iDochostUIFlag;
                //pWB.FileDownloadDirectory = WebBrower.FileDownloadDirectory;
                //pWB.DownloadActiveX = false;
                //pWB.DownloadFrames = true;
                //pWB.DownloadImages = true;
                //pWB.DownloadJava = true;
                //pWB.DownloadScripts = true;
                //pWB.DownloadSounds = false;
                //pWB.DownloadVideo = false;

                pWB.RegisterAsBrowser = true;
                this.RegisterEvent(pWB);

                //Add to controls collection
                //this.Controls.Add(pWB);
                BrowerPannel.Controls.Add(pWB);

                if (BringToFront)
                {
                    //Bring to front
                    pWB.BringToFront();
                }
                //Increase count
                WebBrower = pWB;
            }
            catch (Exception ee)
            {
                return(false);
            }

            return(true);
        }