WebBrowser open a new page

Requires newly opened web page controlled by the WebBrowser solution is simple, in two cases, one opens a new page in the current WebBrowser, the second is the new Form of WebBrowser open a new page:
      

         public the Form1 () 
        { 
            the InitializeComponent (); 
            the this .webBrowser1.AllowWebBrowserDrop = to false ;   // may be set in the property, it is important 

            // the WebBrowser new Form through opening 
            ( the this .webBrowser1.ActiveXInstance AS SHDocVw.WebBrowser) .NewWindow2 = + new new SHDocVw.DWebBrowserEvents2_NewWindow2EventHandler (Form1_NewWindow2); 

            // open the main WebBrowser
             // (this.webBrowser1.ActiveXInstance AS SHDocVw.WebBrowser) + = new new .NewWindow3 SHDocVw.DWebBrowserEvents2_NewWindow3EventHandler (Form1_NewWindow3); 
        } 

        void Form1_NewWindow2 (REF  Object ppDisp, REF  BOOL the Cancel) 
    { 
      Form5 FRM = new new Form5 (); // advance the completed form with WebBrowser 
      ppDisp = frm.webBrowser1.ActiveXInstance; 
      frm.Show (); 
    } 

        void Form1_NewWindow3 ( REF  Object ppDisp, REF  BOOL the Cancel, uint the dwFlags, String bstrUrlContext, String bstrUrl) 
        { 
            the Cancel = to true ;
             the this .webBrowser1.Navigate (bstrUrl); 
        }


If you then open a new page in a new window, the main page and a new page in the same session, may affect each other.

Another: SHDocVw.dll in C: / WINDOWS / SYSTEM32, you want to refer to the project in the past, this is the basis, not there should doubt
it. ----------------
copyright: This article is the original article CSDN bloggers "niechunyang" of.
Original link: https: //blog.csdn.net/niechunyang/article/details/5147665

Guess you like

Origin www.cnblogs.com/towerbit/p/12460115.html